Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError in test_bundle_trt_export #8354

Closed
KumoLiu opened this issue Feb 19, 2025 · 4 comments · Fixed by #8357 or #8361
Closed

FileNotFoundError in test_bundle_trt_export #8354

KumoLiu opened this issue Feb 19, 2025 · 4 comments · Fixed by #8357 or #8361
Labels
bug Something isn't working

Comments

@KumoLiu
Copy link
Contributor

KumoLiu commented Feb 19, 2025

[2025-02-18T15:17:28.748Z] ======================================================================

[2025-02-18T15:17:28.748Z] ERROR: test_onnx_trt_export_0_fp32 (tests.bundle.test_bundle_trt_export.TestTRTExport)

[2025-02-18T15:17:28.748Z] ----------------------------------------------------------------------

[2025-02-18T15:17:28.748Z] Traceback (most recent call last):

[2025-02-18T15:17:28.748Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func

[2025-02-18T15:17:28.748Z]     return func(*(a + p.args), **p.kwargs, **kw)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/test_bundle_trt_export.py", line 123, in test_onnx_trt_export

[2025-02-18T15:17:28.748Z]     parser.read_config(config_file)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 319, in read_config

[2025-02-18T15:17:28.748Z]     content.update(self.load_config_files(f, **kwargs))

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 426, in load_config_files

[2025-02-18T15:17:28.748Z]     config_dict = cls.load_config_file(i, **kwargs)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 398, in load_config_file

[2025-02-18T15:17:28.748Z]     with open(_filepath) as f:

[2025-02-18T15:17:28.748Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/testing_data/inference.json'

[2025-02-18T15:17:28.748Z] 

[2025-02-18T15:17:28.748Z] ======================================================================

[2025-02-18T15:17:28.748Z] ERROR: test_onnx_trt_export_1_fp16 (tests.bundle.test_bundle_trt_export.TestTRTExport)

[2025-02-18T15:17:28.748Z] ----------------------------------------------------------------------

[2025-02-18T15:17:28.748Z] Traceback (most recent call last):

[2025-02-18T15:17:28.748Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func

[2025-02-18T15:17:28.748Z]     return func(*(a + p.args), **p.kwargs, **kw)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/test_bundle_trt_export.py", line 123, in test_onnx_trt_export

[2025-02-18T15:17:28.748Z]     parser.read_config(config_file)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 319, in read_config

[2025-02-18T15:17:28.748Z]     content.update(self.load_config_files(f, **kwargs))

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 426, in load_config_files

[2025-02-18T15:17:28.748Z]     config_dict = cls.load_config_file(i, **kwargs)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 398, in load_config_file

[2025-02-18T15:17:28.748Z]     with open(_filepath) as f:

[2025-02-18T15:17:28.748Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/testing_data/inference.json'

[2025-02-18T15:17:28.748Z] 

[2025-02-18T15:17:28.748Z] ======================================================================

[2025-02-18T15:17:28.748Z] ERROR: test_trt_export_0_fp32 (tests.bundle.test_bundle_trt_export.TestTRTExport)

[2025-02-18T15:17:28.748Z] ----------------------------------------------------------------------

[2025-02-18T15:17:28.748Z] Traceback (most recent call last):

[2025-02-18T15:17:28.748Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func

[2025-02-18T15:17:28.748Z]     return func(*(a + p.args), **p.kwargs, **kw)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/test_bundle_trt_export.py", line 85, in test_trt_export

[2025-02-18T15:17:28.748Z]     parser.read_config(config_file)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 319, in read_config

[2025-02-18T15:17:28.748Z]     content.update(self.load_config_files(f, **kwargs))

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 426, in load_config_files

[2025-02-18T15:17:28.748Z]     config_dict = cls.load_config_file(i, **kwargs)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 398, in load_config_file

[2025-02-18T15:17:28.748Z]     with open(_filepath) as f:

[2025-02-18T15:17:28.748Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/testing_data/inference.json'

[2025-02-18T15:17:28.748Z] 

[2025-02-18T15:17:28.748Z] ======================================================================

[2025-02-18T15:17:28.748Z] ERROR: test_trt_export_1_fp16 (tests.bundle.test_bundle_trt_export.TestTRTExport)

[2025-02-18T15:17:28.748Z] ----------------------------------------------------------------------

[2025-02-18T15:17:28.748Z] Traceback (most recent call last):

[2025-02-18T15:17:28.748Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func

[2025-02-18T15:17:28.748Z]     return func(*(a + p.args), **p.kwargs, **kw)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/test_bundle_trt_export.py", line 85, in test_trt_export

[2025-02-18T15:17:28.748Z]     parser.read_config(config_file)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 319, in read_config

[2025-02-18T15:17:28.748Z]     content.update(self.load_config_files(f, **kwargs))

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 426, in load_config_files

[2025-02-18T15:17:28.748Z]     config_dict = cls.load_config_file(i, **kwargs)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 398, in load_config_file

[2025-02-18T15:17:28.748Z]     with open(_filepath) as f:

[2025-02-18T15:17:28.748Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/testing_data/inference.json'

[2025-02-18T15:17:28.748Z] 

[2025-02-18T15:17:28.748Z] ======================================================================

[2025-02-18T15:17:28.748Z] ERROR: test_trt_export_2_fp32 (tests.bundle.test_bundle_trt_export.TestTRTExport)

[2025-02-18T15:17:28.748Z] ----------------------------------------------------------------------

[2025-02-18T15:17:28.748Z] Traceback (most recent call last):

[2025-02-18T15:17:28.748Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func

[2025-02-18T15:17:28.748Z]     return func(*(a + p.args), **p.kwargs, **kw)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/test_bundle_trt_export.py", line 85, in test_trt_export

[2025-02-18T15:17:28.748Z]     parser.read_config(config_file)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 319, in read_config

[2025-02-18T15:17:28.748Z]     content.update(self.load_config_files(f, **kwargs))

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 426, in load_config_files

[2025-02-18T15:17:28.748Z]     config_dict = cls.load_config_file(i, **kwargs)

[2025-02-18T15:17:28.748Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 398, in load_config_file

[2025-02-18T15:17:28.749Z]     with open(_filepath) as f:

[2025-02-18T15:17:28.749Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/testing_data/inference.json'

[2025-02-18T15:17:28.749Z] 

[2025-02-18T15:17:28.749Z] ======================================================================

[2025-02-18T15:17:28.749Z] ERROR: test_trt_export_3_fp16 (tests.bundle.test_bundle_trt_export.TestTRTExport)

[2025-02-18T15:17:28.749Z] ----------------------------------------------------------------------

[2025-02-18T15:17:28.749Z] Traceback (most recent call last):

[2025-02-18T15:17:28.749Z]   File "/usr/local/lib/python3.10/dist-packages/parameterized/parameterized.py", line 620, in standalone_func

[2025-02-18T15:17:28.749Z]     return func(*(a + p.args), **p.kwargs, **kw)

[2025-02-18T15:17:28.749Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/test_bundle_trt_export.py", line 85, in test_trt_export

[2025-02-18T15:17:28.749Z]     parser.read_config(config_file)

[2025-02-18T15:17:28.749Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 319, in read_config

[2025-02-18T15:17:28.749Z]     content.update(self.load_config_files(f, **kwargs))

[2025-02-18T15:17:28.749Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 426, in load_config_files

[2025-02-18T15:17:28.749Z]     config_dict = cls.load_config_file(i, **kwargs)

[2025-02-18T15:17:28.749Z]   File "/home/jenkins/agent/workspace/Monai-latest-image/monai/bundle/config_parser.py", line 398, in load_config_file

[2025-02-18T15:17:28.749Z]     with open(_filepath) as f:

[2025-02-18T15:17:28.749Z] FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/agent/workspace/Monai-latest-image/tests/bundle/testing_data/inference.json'
@KumoLiu KumoLiu added the bug Something isn't working label Feb 19, 2025
@KumoLiu
Copy link
Contributor Author

KumoLiu commented Feb 19, 2025

Hi @garciadias, could you please help take a look at this issue? It should be due to refactor that the file can't be found in this test. Thanks!

@garciadias
Copy link
Contributor

Hi @KumoLiu, I think I have solved the problem.
While running the ./runtests.sh -f -u --net --coverage locally I see two errors:

======================================================================
ERROR: test_ngc_private_source_download_bundle_0 (tests.bundle.test_bundle_download.TestDownload)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rd24/kcl/MONAI/tests/test_utils.py", line 827, in command_line_tests
    normal_out = subprocess.run(cmd, env=test_env, check=True, capture_output=True)
  File "/home/rd24/.pyenv/versions/3.9.21/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['coverage', 'run', '-m', 'monai.bundle', 'download', '--args_file', '/tmp/tmpzbelz9a1/def_args.json', '--progress', 'False', '--source', 'ngc_private']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/rd24/kcl/MONAI/.venv/lib/python3.9/site-packages/parameterized/parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
  File "/home/rd24/kcl/MONAI/tests/bundle/test_bundle_download.py", line 189, in test_ngc_private_source_download_bundle
    command_line_tests(cmd)
  File "/home/rd24/kcl/MONAI/tests/test_utils.py", line 833, in command_line_tests
    raise RuntimeError(f"subprocess call error {e.returncode}: {errors}, {output}") from e
RuntimeError: subprocess call error 1: b'Traceback (most recent call last):
  File "/home/rd24/kcl/MONAI/monai/bundle/__main__.py", line 31, in <module>
    fire.Fire()
  File "/home/rd24/kcl/MONAI/.venv/lib/python3.9/site-packages/fire/core.py", line 135, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/rd24/kcl/MONAI/.venv/lib/python3.9/site-packages/fire/core.py", line 468, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/home/rd24/kcl/MONAI/.venv/lib/python3.9/site-packages/fire/core.py", line 684, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/rd24/kcl/MONAI/monai/bundle/scripts.py", line 558, in download
    raise ValueError(f"repo should be in the form of `org/org_name/team/team_name` or `org/org_name`, got {repo_}.")
ValueError: repo should be in the form of `org/org_name/team/team_name` or `org/org_name`, got Project-MONAI/model-zoo/hosting_storage_v1.
', b"2025-02-19 09:47:40,313 - INFO - --- input summary of monai.bundle.scripts.download ---
2025-02-19 09:47:40,313 - INFO - > name: 'brats_mri_segmentation'
2025-02-19 09:47:40,313 - INFO - > bundle_dir: '/tmp/tmpzbelz9a1'
2025-02-19 09:47:40,313 - INFO - > source: 'ngc_private'
2025-02-19 09:47:40,313 - INFO - > remove_prefix: 'monai_'
2025-02-19 09:47:40,313 - INFO - > progress: False
2025-02-19 09:47:40,313 - INFO - ---


"

======================================================================
ERROR: test_ensemble (tests.integration.test_auto3dseg_ensemble.TestEnsembleBuilder)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rd24/kcl/MONAI/tests/integration/test_auto3dseg_ensemble.py", line 174, in test_ensemble
    algo.train(_train_param)
  File "/tmp/tmpicj_8wjl/workdir/algorithm_templates/dints/scripts/algo.py", line 496, in train
  File "/home/rd24/kcl/MONAI/monai/apps/auto3dseg/bundle_gen.py", line 277, in _run_cmd
    return run_cmd(cmd.split(), run_cmd_verbose=True, env=ps_environ, check=True)
  File "/home/rd24/kcl/MONAI/monai/utils/misc.py", line 892, in run_cmd
    return subprocess.run(cmd_list, **kwargs)
  File "/home/rd24/.pyenv/versions/3.9.21/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['python', '/tmp/tmp32lmbvhi/workdir/dints_0/scripts/train.py', 'run', "--config_file='/tmp/tmp32lmbvhi/workdir/dints_0/configs/hyper_parameters.yaml,/tmp/tmp32lmbvhi/workdir/dints_0/configs/hyper_parameters_search.yaml,/tmp/tmp32lmbvhi/workdir/dints_0/configs/network.yaml,/tmp/tmp32lmbvhi/workdir/dints_0/configs/network_search.yaml,/tmp/tmp32lmbvhi/workdir/dints_0/configs/transforms_infer.yaml,/tmp/tmp32lmbvhi/workdir/dints_0/configs/transforms_train.yaml,/tmp/tmp32lmbvhi/workdir/dints_0/configs/transforms_validate.yaml'", '--training#num_images_per_batch=2', '--training#num_epochs=2', '--training#num_epochs_per_validation=1']' returned non-zero exit status 1.

Would you like me to solve these on this PR as well?

@KumoLiu
Copy link
Contributor Author

KumoLiu commented Feb 19, 2025

Hi @garciadias, thank you for the quick fix! The first error you mentioned is due to the absence of a private NGC org arg setting, which has been configured in the CI environment, so that should be fine.

As for the second issue, I will leave it to @mingxin-zheng help take a look at it.

In the meantime, we can go ahead and merge your PR. Thanks again!

KumoLiu added a commit that referenced this issue Feb 20, 2025
Fixes #8354

### Description

Fixes path on test that is only run on special conditions.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: R. Garcia-Dias <[email protected]>
Co-authored-by: YunLiu <[email protected]>
@KumoLiu KumoLiu reopened this Feb 21, 2025
@KumoLiu
Copy link
Contributor Author

KumoLiu commented Feb 21, 2025

One missing place:

tests_dir = Path(__file__).resolve().parent

cc @garciadias

KumoLiu pushed a commit that referenced this issue Feb 21, 2025
Fixes #8354 

### Description

A few sentences describing the changes proposed in this pull request.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: R. Garcia-Dias <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants