@@ -85,7 +85,7 @@ def _handle_workflow_message(self, msg: WorkflowMessage) -> None:
85
85
step (or steps) to launch (run) first."""
86
86
assert msg
87
87
88
- _LOGGER .debug ("WorkflowMessage:\n %s" , str (msg ))
88
+ _LOGGER .info ("WorkflowMessage:\n %s" , str (msg ))
89
89
assert msg .action in ["START" , "STOP" ]
90
90
91
91
r_wfid = msg .running_workflow
@@ -106,14 +106,17 @@ def _handle_workflow_start_message(self, r_wfid: str) -> None:
106
106
response , _ = self ._wapi_adapter .get_running_workflow (
107
107
running_workflow_id = r_wfid
108
108
)
109
+ _LOGGER .debug (
110
+ "API.get_running_workflow(%s) returned: -\n %s" , r_wfid , str (response )
111
+ )
109
112
assert "running_workflow" in response
110
113
running_workflow = response ["running_workflow" ]
111
114
assert "user_id" in running_workflow
112
115
launching_user_name : str = running_workflow ["user_id" ]
113
- _LOGGER .debug ("RunningWorkflow: %s" , running_workflow )
114
116
# Now get the workflow definition (to get all the steps)
115
117
wfid = running_workflow ["workflow" ]["id" ]
116
118
response , _ = self ._wapi_adapter .get_workflow (workflow_id = wfid )
119
+ _LOGGER .debug ("API.get_workflow(%s) returned: -\n %s" , wfid , str (response ))
117
120
assert "workflow" in response
118
121
workflow = response ["workflow" ]
119
122
@@ -125,6 +128,12 @@ def _handle_workflow_start_message(self, r_wfid: str) -> None:
125
128
running_workflow_id = r_wfid ,
126
129
step = first_step_name ,
127
130
)
131
+ _LOGGER .debug (
132
+ "API.create_running_workflow_step(%s, %s) returned: -\n %s" ,
133
+ r_wfid ,
134
+ first_step_name ,
135
+ str (response ),
136
+ )
128
137
assert "id" in response
129
138
r_wfsid = response ["id" ]
130
139
@@ -136,6 +145,15 @@ def _handle_workflow_start_message(self, r_wfid: str) -> None:
136
145
137
146
project_id = running_workflow ["project_id" ]
138
147
variables = running_workflow ["variables" ]
148
+
149
+ _LOGGER .info (
150
+ "RunningWorkflow: %s (name=%s project=%s, variables=%s)" ,
151
+ r_wfid ,
152
+ running_workflow ["name" ],
153
+ project_id ,
154
+ variables ,
155
+ )
156
+
139
157
lp : LaunchParameters = LaunchParameters (
140
158
project_id = project_id ,
141
159
application_id = DM_JOB_APPLICATION_ID ,
@@ -171,7 +189,7 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
171
189
assert msg
172
190
173
191
# The PodMessage has a 'instance', 'has_exit_code', and 'exit_code' values.
174
- _LOGGER .debug ("PodMessage:\n %s" , str (msg ))
192
+ _LOGGER .info ("PodMessage:\n %s" , str (msg ))
175
193
176
194
# ALL THIS CODE ADDED SIMPLY TO DEMONSTRATE THE USE OF THE API ADAPTER
177
195
# AND THE INSTANCE LAUNCHER FOR THE SIMPLEST OF WORKFLOWS: -
@@ -188,10 +206,16 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
188
206
instance_id : str = msg .instance
189
207
exit_code : int = msg .exit_code
190
208
response , _ = self ._wapi_adapter .get_instance (instance_id = instance_id )
209
+ _LOGGER .debug (
210
+ "API.get_instance(%s) returned: -\n %s" , instance_id , str (response )
211
+ )
191
212
r_wfsid : str = response ["running_workflow_step" ]
192
213
response , _ = self ._wapi_adapter .get_running_workflow_step (
193
214
running_workflow_step_id = r_wfsid
194
215
)
216
+ _LOGGER .debug (
217
+ "API.get_running_workflow_step(%s) returned: -\n %s" , r_wfsid , str (response )
218
+ )
195
219
step_name : str = response ["running_workflow_step" ]["step" ]
196
220
197
221
# Get the step's running workflow record.
@@ -200,6 +224,9 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
200
224
response , _ = self ._wapi_adapter .get_running_workflow (
201
225
running_workflow_id = r_wfid
202
226
)
227
+ _LOGGER .debug (
228
+ "API.get_running_workflow(%s) returned: -\n %s" , r_wfid , str (response )
229
+ )
203
230
204
231
if exit_code :
205
232
# The job was launched but it failed.
@@ -219,6 +246,7 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
219
246
wfid = running_workflow ["workflow" ]["id" ]
220
247
assert wfid
221
248
response , _ = self ._wapi_adapter .get_workflow (workflow_id = wfid )
249
+ _LOGGER .debug ("API.get_workflow(%s) returned: -\n %s" , wfid , str (response ))
222
250
workflow = response ["workflow" ]
223
251
224
252
# Given the step for the instance just finished (successfully),
@@ -242,6 +270,12 @@ def _handle_pod_message(self, msg: PodMessage) -> None:
242
270
running_workflow_id = r_wfid ,
243
271
step = next_step_name ,
244
272
)
273
+ _LOGGER .debug (
274
+ "API.create_running_workflow_step(%s, %s) returned: -\n %s" ,
275
+ r_wfid ,
276
+ next_step_name ,
277
+ str (response ),
278
+ )
245
279
assert "id" in response
246
280
r_wfsid = response ["id" ]
247
281
project_id = running_workflow ["project_id" ]
0 commit comments