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

Add job script submission and generation step #120

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions benchcab/benchcab.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@
)
return self.tasks

# TODO(Sean) this method should be the endpoint for the `fluxsite-submit-job`
# command line argument.
def fluxsite_submit_job(self) -> None:
"""Submits the PBS job script step in the fluxsite test workflow."""

Expand Down Expand Up @@ -276,6 +274,9 @@
if self.args.subcommand == "fluxsite-setup-work-dir":
self.fluxsite_setup_work_directory()

if self.args.subcommand == "fluxsite-submit-job":
self.fluxsite_submit_job()

Check warning on line 278 in benchcab/benchcab.py

View check run for this annotation

Codecov / codecov/patch

benchcab/benchcab.py#L277-L278

Added lines #L277 - L278 were not covered by tests

if self.args.subcommand == "fluxsite-run-tasks":
self.fluxsite_run_tasks()

Expand Down
30 changes: 26 additions & 4 deletions benchcab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def generate_parser() -> argparse.ArgumentParser:
action="store_true",
help="Force benchcab to execute tasks on the current compute node.",
)
args_run_subcommand.add_argument(

# parent parser that contains arguments common to all composite subcommands
args_composite_subcommand = argparse.ArgumentParser(add_help=False)
args_composite_subcommand.add_argument(
"--skip",
action="append",
default=[],
Expand Down Expand Up @@ -68,7 +71,12 @@ def generate_parser() -> argparse.ArgumentParser:
# subcommand: 'benchcab run'
subparsers.add_parser(
"run",
parents=[args_help, args_subcommand, args_run_subcommand],
parents=[
args_help,
args_subcommand,
args_run_subcommand,
args_composite_subcommand,
],
help="Run all test suites for CABLE.",
description="""Runs all test suites for CABLE: fluxsite and spatial test suites. This
command runs the full default set of tests for CABLE.""",
Expand All @@ -78,11 +86,16 @@ def generate_parser() -> argparse.ArgumentParser:
# subcommand: 'benchcab fluxsite'
subparsers.add_parser(
"fluxsite",
parents=[args_help, args_subcommand, args_run_subcommand],
parents=[
args_help,
args_subcommand,
args_run_subcommand,
args_composite_subcommand,
],
help="Run the fluxsite test suite for CABLE.",
description="""Runs the default fluxsite test suite for CABLE. This command is the
equivalent of running 'benchcab checkout', 'benchcab build', 'benchcab
fluxsite-setup-work-dir', and 'benchcab fluxsite-run-tasks' sequentially.""",
fluxsite-setup-work-dir', and 'benchcab fluxsite-submit-job' sequentially.""",
add_help=False,
)

Expand Down Expand Up @@ -116,6 +129,15 @@ def generate_parser() -> argparse.ArgumentParser:
add_help=False,
)

# subcommand: 'benchcab fluxsite-submit-job'
subparsers.add_parser(
"fluxsite-submit-job",
parents=[args_help, args_subcommand, args_composite_subcommand],
help="Generate and submit the PBS job script for the fluxsite test suite.",
description="""Generates and submits the PBS job script for the fluxsite test suite.""",
add_help=False,
)

# subcommand: 'benchcab fluxsite-run-tasks'
subparsers.add_parser(
"fluxsite-run-tasks",
Expand Down
9 changes: 9 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ def test_cli_parser():
"verbose": False,
}

# Success case: default fluxsite-submit-job command
res = vars(parser.parse_args(["fluxsite-submit-job"]))
assert res == {
"subcommand": "fluxsite-submit-job",
"config": "config.yaml",
"verbose": False,
"skip": [],
}

# Success case: default fluxsite run-tasks command
res = vars(parser.parse_args(["fluxsite-run-tasks"]))
assert res == {
Expand Down