@@ -68,18 +68,32 @@ def __init__(
68
68
elif os .path .isdir (file_path ):
69
69
shutil .rmtree (file_path )
70
70
71
- def launch (self , launch_parameters : LaunchParameters ) -> LaunchResult :
71
+ def launch (self , * , launch_parameters : LaunchParameters ) -> LaunchResult :
72
72
assert launch_parameters
73
73
assert launch_parameters .project_id == TEST_PROJECT_ID
74
74
assert launch_parameters .specification
75
75
assert isinstance (launch_parameters .specification , dict )
76
76
77
77
os .makedirs (EXECUTION_DIRECTORY , exist_ok = True )
78
78
79
- # Create an Instance record (and dummy Task ID)
80
- response = self ._api_adapter .create_instance (
81
- running_workflow_step_id = launch_parameters .running_workflow_step_id
79
+ # Create a running workflow step
80
+ assert launch_parameters .running_workflow_id
81
+ assert launch_parameters .step_name
82
+ response , _ = self ._api_adapter .create_running_workflow_step (
83
+ running_workflow_id = launch_parameters .running_workflow_id ,
84
+ step = launch_parameters .step_name ,
85
+ replica = launch_parameters .step_replication_number ,
82
86
)
87
+ assert "id" in response
88
+ rwfs_id : str = response ["id" ]
89
+ # And add the variables we've been provided with
90
+ if launch_parameters .variables :
91
+ _ = self ._api_adapter .set_running_workflow_step_variables (
92
+ running_workflow_step_id = rwfs_id , variables = launch_parameters .variables
93
+ )
94
+
95
+ # Create an Instance record (and dummy Task ID)
96
+ response = self ._api_adapter .create_instance (running_workflow_step_id = rwfs_id )
83
97
instance_id = response ["id" ]
84
98
task_id = "task-00000000-0000-0000-0000-000000000001"
85
99
@@ -96,8 +110,8 @@ def launch(self, launch_parameters: LaunchParameters) -> LaunchResult:
96
110
# The command may not need any, but we do the decoding anyway.
97
111
decoded_command , status = job_decoder .decode (
98
112
job ["command" ],
99
- launch_parameters .specification_variables ,
100
- launch_parameters . running_workflow_step_id ,
113
+ launch_parameters .variables ,
114
+ rwfs_id ,
101
115
TextEncoding .JINJA2_3_0 ,
102
116
)
103
117
print (f"Decoded command: { decoded_command } " )
@@ -129,6 +143,7 @@ def launch(self, launch_parameters: LaunchParameters) -> LaunchResult:
129
143
self ._msg_dispatcher .send (pod_message )
130
144
131
145
return LaunchResult (
146
+ running_workflow_step_id = rwfs_id ,
132
147
instance_id = instance_id ,
133
148
task_id = task_id ,
134
149
command = " " .join (subprocess_cmd ),
0 commit comments