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

partial codes range for partial failures #250

Merged
merged 1 commit into from
Jul 12, 2024
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
3 changes: 3 additions & 0 deletions src/sophios/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
parser.add_argument('--partial_failure_success_codes', nargs='*', type=int, default=[0, 1], required=False,
help='Let users add custom error codes to be treated as success')

parser.add_argument('--partial_failure_success_codes_range', nargs=2, type=int, default=[0, 1], required=False,
help='Let users add custom error code range to be treated as success')

group_run = parser.add_mutually_exclusive_group()
group_run.add_argument('--generate_run_script', default=False, action="store_true",
help='Just generates run.sh and exits. Does not actually invoke ./run.sh')
Expand Down
7 changes: 6 additions & 1 deletion src/sophios/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ def cwl_update_outputs_optional(cwl: Cwl) -> Cwl:
# default value of cwl_mod['successCodes'] = 0 and 'partial_failure_success_codes' = [0,1]
# take the Union of 0 and partial_failure_success_codes, the 'successCodes' might not be set
# never discard 0 (actual success)
cwl_mod['successCodes'] = list(set([0] + args.partial_failure_success_codes))
failure_code_range = args.partial_failure_success_codes_range
codes_from_range = list(range(failure_code_range[0], failure_code_range[1]))
direct_failure_codes = args.partial_failure_success_codes
assert failure_code_range[0] <= failure_code_range[1], \
f"lower {failure_code_range[0]} value can't be greater than higher {failure_code_range[1]} value"
cwl_mod['successCodes'] = list(set([0] + direct_failure_codes + codes_from_range))
# Update outputs optional
for out_key, out_val_dict in cwl_mod['outputs'].items():
if isinstance(out_val_dict['type'], str) and out_val_dict['type'][-1] != '?':
Expand Down
Loading