Add option to exit with error status if workflow is incomplete#108
Merged
maddenp-cu merged 7 commits intoNOAA-GSL:mainfrom Feb 24, 2026
Merged
Add option to exit with error status if workflow is incomplete#108maddenp-cu merged 7 commits intoNOAA-GSL:mainfrom
maddenp-cu merged 7 commits intoNOAA-GSL:mainfrom
Conversation
maddenp-cu
commented
Feb 24, 2026
| cfgfile = tmp_path / "config.yaml" | ||
| with cfgfile.open("w") as f: | ||
| yaml.safe_dump(config_data, f) | ||
| cfgfile.write_text(yaml.safe_dump(config_data)) |
Collaborator
Author
There was a problem hiding this comment.
In a few places, I simplified code slightly by using Path.read_text() or Path.write_text().
Comment on lines
+87
to
+106
| @mark.parametrize("switch", ["-f", "--fail", None]) | ||
| def test_cli_main__fail(config_data, switch, tmp_path): | ||
| @external | ||
| def bad(_): | ||
| yield "bad" | ||
| yield Asset(None, lambda: False) | ||
|
|
||
| cfgfile = tmp_path / "config.yaml" | ||
| cfgfile.write_text(yaml.safe_dump(config_data)) | ||
| argv = [pkgname, "-c", str(cfgfile), "-t", "bad", switch] | ||
| with ( | ||
| patch.object(cli.sys, "argv", list(filter(None, argv))), | ||
| patch.object(workflow, "bad", create=True, new=bad), | ||
| ): | ||
| if switch: | ||
| with raises(SystemExit) as e: | ||
| cli.main() | ||
| assert e.value.code == 1 | ||
| else: | ||
| cli.main() |
Collaborator
Author
There was a problem hiding this comment.
Test for the new feature.
I also verified manually with a real config and vx use case.
| cli.main() | ||
| assert e.value.code == 1 | ||
| assert "No such task: foo" in caplog.messages | ||
| assert logged("No such task: foo") |
Collaborator
Author
There was a problem hiding this comment.
I simplified a few tests by using the logged fixture instead of interacting with caplog directly.
Comment on lines
+39
to
+41
| node = task(c, threads=args.threads) | ||
| if args.fail and not node.ready: | ||
| fail(f"Task '{args.task}' is incomplete") |
Collaborator
Author
There was a problem hiding this comment.
Main logic for the new feature.
Comment on lines
+90
to
+95
| optional.add_argument( | ||
| "-f", | ||
| "--fail", | ||
| action="store_true", | ||
| help="Exit with error status if task is incomplete", | ||
| ) |
Collaborator
Author
There was a problem hiding this comment.
Add the new feature to the CLI.
Co-authored-by: Emily Carpenter <137525341+elcarpenterNOAA@users.noreply.github.com>
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.
No description provided.