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

Calling get_crontab_contents.py as a script fails #1141

Closed
mkavulich opened this issue Oct 18, 2024 · 0 comments · Fixed by #1142
Closed

Calling get_crontab_contents.py as a script fails #1141

mkavulich opened this issue Oct 18, 2024 · 0 comments · Fixed by #1142
Labels
bug Something isn't working

Comments

@mkavulich
Copy link
Collaborator

Expected behavior

get_crontab_contents.py should be callable as a python script.

Current behavior

#1131 introduced a bug on line 227that misnames the ArgumentParser.parse_args method to _parse_args; likely as a copy-paste error when renaming our internal method of the same name.

Machines affected

All

Steps To Reproduce

  1. Clone and build the code (technically only the conda part of the build is needed for reproducing this bug)
  2. Load the workflow module for your machine, activate conda environment
  3. Run python3 get_crontab_contents.py -m [your_platform] and observe the error:
Traceback (most recent call last):
  File "/mnt/lfs5/BMC/gsd-fv3-test/kavulich/UFS/workdir/test_develop/2024-10-11/intel/ufs-srweather-app/ush/get_crontab_contents.py", line 237, in <module>
    args = _parse_args(sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/lfs5/BMC/gsd-fv3-test/kavulich/UFS/workdir/test_develop/2024-10-11/intel/ufs-srweather-app/ush/get_crontab_contents.py", line 227, in _parse_args
    args = parser._parse_args(argv)
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'ArgumentParser' object has no attribute '_parse_args'. Did you mean: 'parse_args'?

Detailed Description of Fix (optional)

Rename parser._parse_args back to the correct parser.parse_args

Additional Information

This problem was missed because the failure only occurs get_crontab_contents.py is called as a script for parsing arguments; imported calls to the function get_crontab_contents (which we have in both our unit test and in generate_FV3LAM_workflow.py) work just fine. The script is only called from ush/launch_FV3LAM_wflow.sh, and this is not covered in any of our automated or WE2E tests. We should consider adding tests for this script in the future.

@mkavulich mkavulich added the bug Something isn't working label Oct 18, 2024
mkavulich added a commit that referenced this issue Oct 18, 2024
Fix bug described in issue #1141
MichaelLueken pushed a commit that referenced this issue Oct 21, 2024
Fixes bug described in issue #1141: get_crontab_contents.py fails when run as a script
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
Development

Successfully merging a pull request may close this issue.

1 participant