Skip to content

Commit

Permalink
partial codes range for partial failures (#250)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasu Jaganath <vasu.jaganath@axleinfo.com>
  • Loading branch information
vjaganat90 and Vasu Jaganath authored Jul 12, 2024
1 parent 59bf667 commit 2732a0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 2732a0f

Please sign in to comment.