-
Notifications
You must be signed in to change notification settings - Fork 42
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
Print usage when no args provided #404
Conversation
Hi @kinow -- Thanks for the contribution! Must say you have impeccable timing; I had someone encounter this recently, so it was on my mind. I've approved the MR to run through our CI and will review the code in a bit. :) Thanks again for your contribution! |
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.
@kinow -- it looks like you can set the default function. I generally avoid hasattr
since that's been considered bad practice from what I've seen. Talking with @jwhite242 and with some searching, it seems that this might be the better bet:
parser = ArgumentParser(
prog="maestro",
description="The Maestro Workflow Conductor for specifying, launching"
", and managing general workflows.",
formatter_class=RawTextHelpFormatter)
# This call applies a default function to the main parser as described
# here: https://stackoverflow.com/a/61680800
parser.set_defaults(func=lambda args: parser.print_help())
Hi @FrankD412 I normally use +1 to using a default value if that's available. Give me 10 mins and I'll update the branch and test locally… |
1.1.10 Release (#432) * Sync up read the docs config with dev environments using poetry (#399) * Print usage on command line when no args are provided (#404) * Add sacct fallback to slurm adapter to improve robustness of job tracking (#405) * Update Flurm Job State mappings for flux versions >= 0.26 (#407) * Bump certifi from 2021.10.8 to 2022.12.7 to address security issue (#409) * Bump cryptography from 37.0.1 to 38.0.3 to address security issue (#410) * Add missing shbang in unscheduled scripts from lsf adapter (#411) * Update poetry lockfile to address dependabot flagged security issues (#412) * Fix for Dockerfile smell DL3006 (#418) * Port Maestro documentation to mkdocs and expand coverage of features and tutorials (#403) * Update version info to be driven from pyproject.toml exclusively, and hook up to command line (#419) * Pin mermaid to < 10.x due to api change (#422) * Bump lock file certifi from 2022.12.7 to 2023.7.22 to address security issue (#426) * Refactor flux adapter to avoid using pickle to talk to flux brokers installed in external environments (#415) Also adds flux integration tests to exercise against real flux brokers * Add pager functionality to status command (#420) * Patch broken flux job cancellation (#428) * Insulate slurm adapters from user customization of squeue and sacct output formats (#431) Also adds live unit and integration tests for slurm adapter --------- Co-authored-by: Francesco Di Natale <frank.dinatale1988@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bruno P. Kinoshita <kinow@users.noreply.github.com> Co-authored-by: Charles Doutriaux <doutriaux1@llnl.gov> Co-authored-by: Giovanni Rosa <grosa23@yahoo.com> Co-authored-by: Brian Gunnarson <49216024+bgunnar5@users.noreply.github.com>
1.1.10 Release (#432) * Sync up read the docs config with dev environments using poetry (#399) * Print usage on command line when no args are provided (#404) * Add sacct fallback to slurm adapter to improve robustness of job tracking (#405) * Update Flurm Job State mappings for flux versions >= 0.26 (#407) * Bump certifi from 2021.10.8 to 2022.12.7 to address security issue (#409) * Bump cryptography from 37.0.1 to 38.0.3 to address security issue (#410) * Add missing shbang in unscheduled scripts from lsf adapter (#411) * Update poetry lockfile to address dependabot flagged security issues (#412) * Fix for Dockerfile smell DL3006 (#418) * Port Maestro documentation to mkdocs and expand coverage of features and tutorials (#403) * Update version info to be driven from pyproject.toml exclusively, and hook up to command line (#419) * Pin mermaid to < 10.x due to api change (#422) * Bump lock file certifi from 2022.12.7 to 2023.7.22 to address security issue (#426) * Refactor flux adapter to avoid using pickle to talk to flux brokers installed in external environments (#415) Also adds flux integration tests to exercise against real flux brokers * Add pager functionality to status command (#420) * Patch broken flux job cancellation (#428) * Insulate slurm adapters from user customization of squeue and sacct output formats (#431) Also adds live unit and integration tests for slurm adapter --------- Co-authored-by: Francesco Di Natale <frank.dinatale1988@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bruno P. Kinoshita <kinow@users.noreply.github.com> Co-authored-by: Charles Doutriaux <doutriaux1@llnl.gov> Co-authored-by: Giovanni Rosa <grosa23@yahoo.com> Co-authored-by: Brian Gunnarson <49216024+bgunnar5@users.noreply.github.com>
Hi,
Running
maestro
for the first time ever today from thedevelop
branch. I first triedmaestro
without anything else, but it resulted in a traceback.I think it would be best to print the program usage instead? So if users are not aware, or not sure, which subcommand/subparser to trigger, they can read the usage and decide then.
Thanks for maestro! 👋
-Bruno
EDIT: closes #188 (hadn't seen the issue, sorry)