File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -322,8 +322,28 @@ def task_matches_labels(t):
322322 # helper lookup
323323 tasknametoid = { t ['name' ]:i for i , t in enumerate (workflowspec ['stages' ],0 ) }
324324
325+ # check if a task can be run at all
326+ # or not due to missing requirements
327+ def canBeDone (t ,cache = {}):
328+ ok = True
329+ c = cache .get (t ['name' ])
330+ if c != None :
331+ return c
332+ for r in t ['needs' ]:
333+ taskid = tasknametoid .get (r )
334+ if taskid != None :
335+ if not canBeDone (workflowspec ['stages' ][taskid ], cache ):
336+ ok = False
337+ break
338+ else :
339+ ok = False
340+ break
341+ cache [t ['name' ]] = ok
342+ return ok
343+
344+ okcache = {}
325345 # build full target list
326- full_target_list = [ t for t in workflowspec ['stages' ] if task_matches (t ['name' ]) and task_matches_labels (t ) ]
346+ full_target_list = [ t for t in workflowspec ['stages' ] if task_matches (t ['name' ]) and task_matches_labels (t ) and canBeDone ( t , okcache ) ]
327347 full_target_name_list = [ t ['name' ] for t in full_target_list ]
328348
329349 # build full dependency list for a task t
You can’t perform that action at this time.
0 commit comments