@@ -59,13 +59,18 @@ class StepPreparationResponse:
59
59
can be launched - it's value indicates how many times. If a step can be launched
60
60
'variables' will not be None. If a parallel set of steps can take place
61
61
(even just one) 'replica_variable' will be set and 'replica_values'
62
- will be a list containing a value for each step instance. If preparation fails
63
- 'erro_num' wil be set, and 'error_msg' should contain something useful."""
62
+ will be a list containing a value for each step instance. If the step
63
+ depends on a prior step the instance UUIDs of the steps will be listed
64
+ in the 'dependent_instances' string list.
65
+
66
+ If preparation fails 'error_num' wil be set, and 'error_msg'
67
+ should contain something useful."""
64
68
65
69
replicas : int
66
70
variables : dict [str , Any ] | None = None
67
71
replica_variable : str | None = None
68
72
replica_values : list [str ] | None = None
73
+ dependent_instances : set [str ] | None = None
69
74
error_num : int = 0
70
75
error_msg : str | None = None
71
76
@@ -402,14 +407,14 @@ def _prepare_step(
402
407
our_inputs : dict [str , Any ] = job_defintion_decoder .get_inputs (
403
408
our_job_definition
404
409
)
405
- our_plumbing : dict [str , list [Connector ]] = get_step_prior_step_connections (
406
- step_definition = step_definition
410
+ plumbing_of_prior_steps : dict [str , list [Connector ]] = (
411
+ get_step_prior_step_connections ( step_definition = step_definition )
407
412
)
408
413
step_is_combiner : bool = False
409
414
step_name_being_combined : str | None = None
410
415
combiner_input_variable : str | None = None
411
416
num_step_recplicas_being_combined : int = 0
412
- for p_step_name , connections in our_plumbing .items ():
417
+ for p_step_name , connections in plumbing_of_prior_steps .items ():
413
418
for connector in connections :
414
419
if our_inputs .get (connector .out , {}).get ("type" ) == "files" :
415
420
step_name_being_combined = p_step_name
@@ -549,7 +554,7 @@ def _prepare_step(
549
554
iter_values : list [str ] = []
550
555
iter_variable : str | None = None
551
556
if not step_is_combiner :
552
- for p_step_name , connections in our_plumbing .items ():
557
+ for p_step_name , connections in plumbing_of_prior_steps .items ():
553
558
# We need to get the Job definition for each step
554
559
# and then check whether the (output) variable is of type 'files'...
555
560
wf_step : dict [str , Any ] = get_step (wf , p_step_name )
@@ -582,12 +587,24 @@ def _prepare_step(
582
587
if iter_variable :
583
588
break
584
589
590
+ # Get the list of instances we depend upon.
591
+ dependent_instances : set [str ] = set ()
592
+ for p_step_name in plumbing_of_prior_steps :
593
+ # Assume any step can have multiple instances
594
+ response , _ = self ._wapi_adapter .get_status_of_all_step_instances_by_name (
595
+ name = p_step_name ,
596
+ running_workflow_id = rwf_id ,
597
+ )
598
+ for step in response ["steps" ]:
599
+ dependent_instances .add (step ["instance_id" ])
600
+
585
601
num_step_instances : int = max (1 , len (iter_values ))
586
602
return StepPreparationResponse (
587
603
variables = variables ,
588
604
replicas = num_step_instances ,
589
605
replica_variable = iter_variable ,
590
606
replica_values = iter_values ,
607
+ dependent_instances = dependent_instances ,
591
608
)
592
609
593
610
def _launch (
@@ -652,6 +669,7 @@ def _launch(
652
669
step_name = step_name ,
653
670
step_replication_number = replica ,
654
671
total_number_of_replicas = total_replicas ,
672
+ dependent_instances = step_preparation_response .dependent_instances ,
655
673
)
656
674
lr : LaunchResult = self ._instance_launcher .launch (launch_parameters = lp )
657
675
rwfs_id = lr .running_workflow_step_id
0 commit comments