@@ -451,8 +451,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
451
451
out_key = keys [0 ]
452
452
out_val = out_val [out_key ]
453
453
if isinstance (out_val , Dict ) and 'wic_anchor' in out_val :
454
- out_val = out_val ['wic_anchor' ]
455
- edgedef = out_val ['key' ]
454
+ edgedef = out_val ['wic_anchor' ]
456
455
457
456
# NOTE: There can only be one definition, but multiple call sites.
458
457
if not explicit_edge_defs_copy .get (edgedef ):
@@ -469,13 +468,12 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
469
468
# Extract input value into separate yml file
470
469
# Replace it here with a new variable name
471
470
arg_val = steps [i ][step_key ]['in' ][arg_key ]
471
+
472
472
# Convert native YAML to a JSON-encoded string for specific tags.
473
473
tags = ['config' ]
474
474
if arg_key in tags and isinstance (arg_val , Dict ) and ('wic_inline_input' in arg_val ):
475
- # Do NOT wrap config: in {'source': ...}
476
- arg_val = {'wic_inline_input' : {'key' : json .dumps (arg_val ['wic_inline_input' ]['key' ])}}
477
- elif isinstance (arg_val , str ):
478
- arg_val = {'source' : arg_val }
475
+ arg_val = {'wic_inline_input' : json .dumps (arg_val ['wic_inline_input' ])}
476
+
479
477
# Use triple underscore for namespacing so we can split later
480
478
in_name = f'{ step_name_i } ___{ arg_key } ' # {step_name_i}_input___{arg_key}
481
479
@@ -495,21 +493,21 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
495
493
# NOTE: Exclude cwl_watcher from explicit edge dereferences.
496
494
# Since cwl_watcher requires explicit filenames for globbing,
497
495
# we do not want to replace them with internal CWL dependencies!
498
- if not explicit_edge_defs_copy .get (arg_val [ 'key' ] ):
496
+ if not explicit_edge_defs_copy .get (arg_val ):
499
497
if is_root and not testing :
500
498
# Even if is_root, we don't want to raise an Exception
501
499
# here because in test_cwl_embedding_independence, we
502
500
# recompile all subworkflows as if they were root. That
503
501
# will cause this code path to be taken but it is not
504
502
# actually an error. Add a CWL input for testing only.
505
- raise Exception (f"Error! No definition found for &{ arg_val [ 'key' ] } !" )
503
+ raise Exception (f"Error! No definition found for &{ arg_val } !" )
506
504
inputs_workflow .update ({in_name : in_dict })
507
505
steps [i ][step_key ]['in' ][arg_key ] = {'source' : in_name }
508
506
# Add a 'dummy' value to explicit_edge_calls anyway, because
509
507
# that determines sub_args_provided when the recursion returns.
510
508
explicit_edge_calls_copy .update ({in_name : (namespaces + [step_name_i ], arg_key )})
511
509
else :
512
- (nss_def_init , var ) = explicit_edge_defs_copy [arg_val [ 'key' ] ]
510
+ (nss_def_init , var ) = explicit_edge_defs_copy [arg_val ]
513
511
514
512
nss_def_embedded = var .split ('___' )[:- 1 ]
515
513
nss_call_embedded = arg_key .split ('___' )[:- 1 ]
@@ -546,7 +544,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
546
544
elif len (nss_call_tails ) > 1 :
547
545
inputs_workflow .update ({in_name : in_dict })
548
546
# Store explicit edge call site info up through the recursion.
549
- d = {in_name : explicit_edge_defs_copy [arg_val [ 'key' ] ]}
547
+ d = {in_name : explicit_edge_defs_copy [arg_val ]}
550
548
# d = {in_name, (namespaces + [step_name_i], var)} # ???
551
549
explicit_edge_calls_copy .update (d )
552
550
steps [i ][step_key ]['in' ][arg_key ] = {'source' : in_name }
@@ -601,7 +599,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
601
599
602
600
utils_graphs .add_graph_edge (args , graph_init , nss_def , nss_call , label , color = 'blue' )
603
601
elif isinstance (arg_val , Dict ) and 'wic_inline_input' in arg_val :
604
- arg_val = arg_val ['wic_inline_input' ][ 'key' ]
602
+ arg_val = arg_val ['wic_inline_input' ]
605
603
606
604
if arg_key in steps [i ][step_key ].get ('scatter' , []):
607
605
# Promote scattered input types to arrays
@@ -624,6 +622,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
624
622
graphdata .nodes .append ((input_node_name , attrs ))
625
623
graphdata .edges .append ((input_node_name , step_node_name , {}))
626
624
else :
625
+ arg_var : str = arg_val
627
626
# Leave un-evaluated, i.e. allow the user to inject raw CWL.
628
627
# The un-evaluated string should refer to either an inputs: variable
629
628
# or an internal CWL dependency, i.e. an output from a previous step.
@@ -638,20 +637,20 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
638
637
# (yet) be inlined. Somehow, if they are not marked with
639
638
# inlineable: False, test_inline_subworkflows can still pass.
640
639
# This Exception will (correctly) cause such inlineing tests to fail.
641
- if arg_val [ 'source' ] not in yaml_tree .get ('inputs' , {}):
640
+ if arg_var not in yaml_tree .get ('inputs' , {}):
642
641
if not args .allow_raw_cwl :
643
- print (f"Warning! Did you forget to use !ii before { arg_val [ 'source' ] } in { yaml_stem } .yml?" )
642
+ print (f"Warning! Did you forget to use !ii before { arg_var } in { yaml_stem } .yml?" )
644
643
print ('If you want to compile the workflow anyway, use --allow_raw_cwl' )
645
644
sys .exit (1 )
646
645
647
646
inputs = yaml_tree .get ('inputs' , {})
648
647
unbound_lit_var = 'Error! Unbound literal variable'
649
648
if inputs == {}:
650
- raise Exception (f"{ unbound_lit_var } { arg_val [ 'source' ] } not in inputs: tag in { yaml_stem } .yml" )
649
+ raise Exception (f"{ unbound_lit_var } { arg_var } not in inputs: tag in { yaml_stem } .yml" )
651
650
inputs_dump = yaml .dump ({'inputs' : inputs })
652
- raise Exception (f"{ unbound_lit_var } { arg_val [ 'source' ] } not in\n { inputs_dump } \n in { yaml_stem } .yml" )
651
+ raise Exception (f"{ unbound_lit_var } { arg_var } not in\n { inputs_dump } \n in { yaml_stem } .yml" )
653
652
654
- inputs_key_dict = yaml_tree ['inputs' ][arg_val [ 'source' ] ]
653
+ inputs_key_dict = yaml_tree ['inputs' ][arg_var ]
655
654
if 'doc' in inputs_key_dict :
656
655
inputs_key_dict ['doc' ] += '\\ n' + in_dict .get ('doc' , '' )
657
656
else :
@@ -661,12 +660,12 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
661
660
else :
662
661
inputs_key_dict ['label' ] = in_dict .get ('label' , '' )
663
662
664
- if arg_val [ 'source' ] in input_mapping_copy :
665
- input_mapping_copy [arg_val [ 'source' ] ].append (in_name )
663
+ if arg_var in input_mapping_copy :
664
+ input_mapping_copy [arg_var ].append (in_name )
666
665
else :
667
- input_mapping_copy [arg_val [ 'source' ] ] = [in_name ]
666
+ input_mapping_copy [arg_var ] = [in_name ]
668
667
# TODO: We can use un-evaluated variable names for input mapping; no notation for output mapping!
669
- steps [i ][step_key ]['in' ][arg_key ] = arg_val # Leave un-evaluated
668
+ steps [i ][step_key ]['in' ][arg_key ] = { 'source' : arg_var } # Leave un-evaluated
670
669
671
670
for arg_key in args_required :
672
671
# print('arg_key', arg_key)
@@ -854,8 +853,7 @@ def compile_workflow_once(yaml_tree_ast: YamlTree,
854
853
else :
855
854
# We cannot store string values as a dict, so use type: ignore
856
855
arg_val = in_dict ['value' ]
857
- new_val = arg_val ['source' ] if isinstance (arg_val , Dict ) and 'source' in arg_val else arg_val
858
- new_keyval = {key : new_val }
856
+ new_keyval = {key : arg_val }
859
857
# else:
860
858
# raise Exception(f"Error! Unknown type: {in_dict['type']}")
861
859
yaml_inputs .update (new_keyval )
0 commit comments