Make sure we check for executable's existence before submitting job#657
Merged
Conversation
…tom action that also checks for executable's existence
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the executable argument validation in jobsub by replacing the simple type validation function with a comprehensive custom argparse Action class. The new implementation checks both that the executable argument uses the correct file:// URI format and that the file actually exists before job submission.
Key Changes
- Replaced
verify_executable_starts_with_file_colonfunction withCheckExecutablecustom action class that performs both URI format and file existence validation - Updated the executable argument definition to use the new action with
type=strandaction=CheckExecutable - Added three new unit tests covering valid executables, invalid URI format, and non-existent files
- Updated two existing tests to provide valid executable arguments now that validation is enforced
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/get_parser.py | Removed old validation function and added CheckExecutable action class that validates URI format and file existence; updated executable argument to use the new action |
| tests/test_get_parser_unit.py | Added fixture and three tests for executable validation; updated existing tests to pass valid executable paths that comply with new validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #631
This PR upgrades the
executableargument in the jobsubget_parserparser to use a customActionthat does two things:file://)There are added accompanying unit tests, as well as a couple of updates to old tests so that they work with this new restriction.
All unit tests pass, and further testing information is available in comments of #631.