-
Notifications
You must be signed in to change notification settings - Fork 20
CLI tool #162
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
CLI tool #162
Conversation
jameshcorbett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nitpicks and questions below.
|
|
||
|
|
||
| ``` | ||
| usage: psij-consol [-h] [-v] [--debug] {validate,run} ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of this name but I can't think of anything better, and we can always change it later I guess.
scripts/psij-consol.py
Outdated
| validate_parser = subparser.add_parser("validate", help='validate JobSpec file') | ||
| validate_parser.add_argument("file", help="JobSpec file") | ||
| execute_parser = subparser.add_parser("run", help='execute JobSpec file') | ||
| execute_parser.add_argument("file", help="JobSpec file") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it should accept multiple files? The tricky part would then be how that interacts with -n.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can always make this change later though.
scripts/psij-consol.py
Outdated
| execute_parser = subparser.add_parser("run", help='execute JobSpec file') | ||
| execute_parser.add_argument("file", help="JobSpec file") | ||
| execute_parser.add_argument("-j", | ||
| "--job-executor", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the executor needs to be specified so I think this should be a mandatory argument and not an --optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you added required=True, but what I meant (although I didn't explain it well, sorry) was to make it a mandatory positional argument, so that usage would look like psij-consol run slurm spec.json rather than psij-consol run spec.json -j slurm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification. Your suggestion makes the cli more intuitive.
scripts/psij-consol.py
Outdated
|
|
||
| print("Initializing job executor") | ||
| jex = psij.JobExecutor.get_instance(args.executor) | ||
| if not (jex and isinstance(jex, JobExecutor)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these checks necessary? Shouldn't the loading mechanism throw a detailed exception in case of failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably does. Changing to try - except.
jameshcorbett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still like to see this comment addressed but it's minor. Otherwise looks good.
|
It would be nice to have some basic tests, but that can always be added in another PR. |
closes #103