Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Fix race condition in unittest by pytest temp_dir fixtures #18323

Merged
merged 3 commits into from
May 21, 2020

Conversation

zhreshold
Copy link
Member

Description

Fix #18322

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the best of my knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@mxnet-bot
Copy link

Hey @zhreshold , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [windows-gpu, centos-gpu, sanity, windows-cpu, miscellaneous, unix-cpu, clang, edge, website, unix-gpu, centos-cpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@leezu
Copy link
Contributor

leezu commented May 14, 2020

Could you clarify where the race occurs?

@zhreshold
Copy link
Member Author

If multiple tests want to create the rec file at the same time, the rec file may be corrupted

@leezu
Copy link
Contributor

leezu commented May 14, 2020

Would creating the rec-file at a temporary path then solve the issue while preserving parallelization? You can take the tmp_path argument in your test function to have pytest provide a temporary directory unique for this test. https://docs.pytest.org/en/latest/tmpdir.html

@leezu
Copy link
Contributor

leezu commented May 19, 2020

@mxnet-bot run ci [centos-cpu, unix-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [centos-cpu, unix-cpu]

@zhreshold zhreshold changed the title Fix race condition in unittest by mark as serial tests Fix race condition in unittest by pytest temp_dir fixtures May 20, 2020
prepare_record()
dataset = gluon.data.vision.ImageFolderDataset('data/test_images')
def test_image_folder_dataset(prepare_record):
print(prepare_record[:-8])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leezu leezu merged commit 67b5d31 into apache:master May 21, 2020
@zhreshold zhreshold deleted the serial-data-unittest branch May 21, 2020 19:13
AntiZpvoh pushed a commit to AntiZpvoh/incubator-mxnet that referenced this pull request Jul 6, 2020
)

* serial tests

* pytest fixture temp_dir

* address comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_recordimage_dataset
3 participants