46
46
get_step_predefined_variable_connections ,
47
47
get_step_prior_step_connections ,
48
48
get_step_workflow_variable_connections ,
49
+ is_workflow_output_variable ,
49
50
)
50
51
51
52
_LOGGER : logging .Logger = logging .getLogger (__name__ )
56
57
@dataclass
57
58
class StepPreparationResponse :
58
59
"""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
60
61
'variables' will not be None. If a parallel set of steps can take place
61
62
(even just one) 'replica_variable' will be set and 'replica_values'
62
63
will be a list containing a value for each step instance. If the step
63
64
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'.
65
67
66
68
If preparation fails 'error_num' wil be set, and 'error_msg'
67
69
should contain something useful."""
@@ -71,6 +73,7 @@ class StepPreparationResponse:
71
73
replica_variable : str | None = None
72
74
replica_values : list [str ] | None = None
73
75
dependent_instances : set [str ] | None = None
76
+ outputs : set [str ] | None = None
74
77
error_num : int = 0
75
78
error_msg : str | None = None
76
79
@@ -479,6 +482,13 @@ def _prepare_step(
479
482
# I think we can start this step,
480
483
# so compile a set of variables for it.
481
484
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
+
482
492
# Start with any variables provided in the step's specification.
483
493
# A map that we will add to (and maybe even over-write)...
484
494
variables : dict [str , Any ] = step_definition ["specification" ].get (
@@ -498,6 +508,8 @@ def _prepare_step(
498
508
):
499
509
assert connector .in_ in rwf_variables
500
510
variables [connector .out ] = rwf_variables [connector .in_ ]
511
+ if is_workflow_output_variable (wf , connector .in_ ):
512
+ outputs .add (rwf_variables [connector .in_ ])
501
513
502
514
# Process the step's "plumbing" relating to pre-defined variables.
503
515
for connector in get_step_predefined_variable_connections (
@@ -607,6 +619,7 @@ def _prepare_step(
607
619
replica_variable = iter_variable ,
608
620
replica_values = iter_values ,
609
621
dependent_instances = dependent_instances ,
622
+ outputs = outputs ,
610
623
)
611
624
612
625
def _launch (
@@ -623,6 +636,16 @@ def _launch(
623
636
rwf_id : str = rwf ["id" ]
624
637
project_id = rwf ["project" ]["id" ]
625
638
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
+
626
649
# Total replicas must be 1 or more
627
650
total_replicas : int = step_preparation_response .replicas
628
651
assert total_replicas >= 1
0 commit comments