4646 get_step_predefined_variable_connections ,
4747 get_step_prior_step_connections ,
4848 get_step_workflow_variable_connections ,
49+ is_workflow_output_variable ,
4950)
5051
5152_LOGGER : logging .Logger = logging .getLogger (__name__ )
5657@dataclass
5758class StepPreparationResponse :
5859 """Step preparation response object. 'replicas' is +ve (non-zero) if a step
59- can be launched - it's value indicates how many times. If a step can be launched
60+ can be launched - its value indicates how many times. If a step can be launched
6061 'variables' will not be None. If a parallel set of steps can take place
6162 (even just one) 'replica_variable' will be set and 'replica_values'
6263 will be a list containing a value for each step instance. If the step
6364 depends on a prior step the instance UUIDs of the steps will be listed
64- in the 'dependent_instances' string list.
65+ in the 'dependent_instances' string list. If a step's outputs (files) are expected
66+ in the project directory they will be listed in 'outputs'.
6567
6668 If preparation fails 'error_num' wil be set, and 'error_msg'
6769 should contain something useful."""
@@ -71,6 +73,7 @@ class StepPreparationResponse:
7173 replica_variable : str | None = None
7274 replica_values : list [str ] | None = None
7375 dependent_instances : set [str ] | None = None
76+ outputs : set [str ] | None = None
7477 error_num : int = 0
7578 error_msg : str | None = None
7679
@@ -479,6 +482,13 @@ def _prepare_step(
479482 # I think we can start this step,
480483 # so compile a set of variables for it.
481484
485+ # Outputs - a list of step files that are outputs,
486+ # and also designated as workflow outputs.
487+ # Any step can write files to the Projetc directory
488+ # but only job outputs that are also workflow outputs
489+ # are put in this list.
490+ outputs : set [str ] = set ()
491+
482492 # Start with any variables provided in the step's specification.
483493 # A map that we will add to (and maybe even over-write)...
484494 variables : dict [str , Any ] = step_definition ["specification" ].get (
@@ -498,6 +508,8 @@ def _prepare_step(
498508 ):
499509 assert connector .in_ in rwf_variables
500510 variables [connector .out ] = rwf_variables [connector .in_ ]
511+ if is_workflow_output_variable (wf , connector .in_ ):
512+ outputs .add (rwf_variables [connector .in_ ])
501513
502514 # Process the step's "plumbing" relating to pre-defined variables.
503515 for connector in get_step_predefined_variable_connections (
@@ -607,6 +619,7 @@ def _prepare_step(
607619 replica_variable = iter_variable ,
608620 replica_values = iter_values ,
609621 dependent_instances = dependent_instances ,
622+ outputs = outputs ,
610623 )
611624
612625 def _launch (
@@ -623,6 +636,16 @@ def _launch(
623636 rwf_id : str = rwf ["id" ]
624637 project_id = rwf ["project" ]["id" ]
625638
639+ _LOGGER .info ("SPR.variable=%s" , step_preparation_response .variables )
640+ _LOGGER .info (
641+ "SPR.replica_variable=%s" , step_preparation_response .replica_variable
642+ )
643+ _LOGGER .info ("SPR.replica_values=%s" , step_preparation_response .replica_values )
644+ _LOGGER .info (
645+ "SPR.dependent_instances=%s" , step_preparation_response .dependent_instances
646+ )
647+ _LOGGER .info ("SPR.outputs=%s" , step_preparation_response .outputs )
648+
626649 # Total replicas must be 1 or more
627650 total_replicas : int = step_preparation_response .replicas
628651 assert total_replicas >= 1
0 commit comments