4
4
"""
5
5
6
6
import os
7
+ from pprint import pprint
7
8
from typing import Any
8
9
9
10
import jsonschema
@@ -225,8 +226,10 @@ def set_step_variables(
225
226
"""
226
227
result = {}
227
228
228
- print ("ssv: wf vars" , workflow_variables )
229
- print ("ssv: inputs" , inputs )
229
+ print ("ssv: wf vars:" )
230
+ pprint (workflow_variables )
231
+ print ("ssv: inputs:" )
232
+ pprint (inputs )
230
233
print ("ssv: outputs" , outputs )
231
234
print ("ssv: step_outputs" , step_outputs )
232
235
print ("ssv: prev step outputs" , previous_step_outputs )
@@ -240,30 +243,35 @@ def set_step_variables(
240
243
p_val = workflow_variables [val ["workflow-input" ]]
241
244
result [p_key ] = p_val
242
245
elif "step" in val .keys ():
243
- for out in previous_step_outputs :
244
- if out ["output" ] == val ["output" ]:
245
- # p_val = out["as"]
246
- if step_outputs ["output" ]:
247
- p_val = step_outputs ["output" ]
248
- print ("\n !!!!!!!!!!!!!if clause!!!!!!!!!!!!!!!!!!!!!\n " )
249
- print (p_val )
250
- else :
251
- # what do I need to do here??
252
- print ("\n !!!!!!!!!!!!!else clause!!!!!!!!!!!!!!!!!!!!!\n " )
253
- print (out )
254
- print (val )
255
-
256
- # this bit handles multiple inputs: if a step
257
- # requires input from multiple steps, add them to
258
- # the list in result dict. this is the reason for
259
- # mypy ignore statements, mypy doesn't understand
260
- # redefinition
261
- if p_key in result :
262
- if not isinstance (result [p_key ], set ):
263
- result [p_key ] = {result [p_key ]} # type: ignore [assignment]
264
- result [p_key ].add (p_val ) # type: ignore [attr-defined]
265
- else :
266
- result [p_key ] = p_val
246
+ # this links the variable to previous step output
247
+ if previous_step_outputs :
248
+ for out in previous_step_outputs :
249
+ if out ["output" ] == val ["output" ]:
250
+ # p_val = out["as"]
251
+ if step_outputs ["output" ]:
252
+ p_val = step_outputs ["output" ]
253
+ print ("\n !!!!!!!!!!!!!if clause!!!!!!!!!!!!!!!!!!!!!\n " )
254
+ print (p_val )
255
+ else :
256
+ # what do I need to do here??
257
+ print ("\n !!!!!!!!!!!!!else clause!!!!!!!!!!!!!!!!!!!!!\n " )
258
+ print (out )
259
+ print (val )
260
+
261
+ # this bit handles multiple inputs: if a step
262
+ # requires input from multiple steps, add them to
263
+ # the list in result dict. this is the reason for
264
+ # mypy ignore statements, mypy doesn't understand
265
+ # redefinition
266
+ if p_key in result :
267
+ if not isinstance (result [p_key ], set ):
268
+ result [p_key ] = {result [p_key ]} # type: ignore [assignment]
269
+ result [p_key ].add (p_val ) # type: ignore [attr-defined]
270
+ else :
271
+ result [p_key ] = p_val
272
+ else :
273
+ if val ["output" ] in workflow_variables :
274
+ result [p_key ] = workflow_variables [val ["output" ]]
267
275
268
276
for item in outputs :
269
277
p_key = item ["output" ]
0 commit comments