@@ -355,28 +355,32 @@ def job_directory_structure(self):
355355 def job_by_id (self , sis_id ):
356356 return self .id_to_job_dict ().get (sis_id )
357357
358- def jobs (self ) -> List [Job ]:
358+ def jobs (self , * , update_graph : bool = True ) -> List [Job ]:
359359 """
360- :return ([Job, ...]): List with all jobs in grpah
360+ :param update_graph: if True, update all nodes/jobs (calling :func:`Job._sis_runnable`)
361+ while running through the graph to get the most current dependency graph.
362+ :return ([Job, ...]): List with all jobs in graph
361363 """
362364 job_list = []
363365
364366 def f (job ):
365367 job_list .append (job )
366368 return True
367369
368- self .for_all_nodes (f )
370+ self .for_all_nodes (f , update_graph = update_graph )
369371 return job_list
370372
371- def find (self , pattern , mode = "all" ):
373+ def find (self , pattern : str , mode : str = "all" , * , update_graph : bool = True ):
372374 """Returns a list with all jobs and paths that partly match the pattern
373375
374- :param pattern(str): Pattern to match
375- :param mode(str): Select if jobs, paths or both should be returned. Possible values: all, path, job
376+ :param pattern: Pattern to match
377+ :param mode: Select if jobs, paths or both should be returned. Possible values: all, path, job
378+ :param update_graph: if True, update all nodes/jobs (calling :func:`Job._sis_runnable`)
379+ while running through the graph to get the most current dependency graph.
376380 :return ([Job/Path, ...]): List with all matching jobs/paths
377381 """
378382 out = set ()
379- for j in self .jobs ():
383+ for j in self .jobs (update_graph = update_graph ):
380384 if mode in ("all" , "job" ):
381385 vis_name = j .get_vis_name ()
382386 aliases = j ._sis_aliases if j ._sis_aliases is not None else set ()
@@ -392,10 +396,12 @@ def find(self, pattern, mode="all"):
392396 out .add (p )
393397 return list (out )
394398
395- def jobs_sorted (self ):
399+ def jobs_sorted (self , * , update_graph : bool = True ):
396400 """Yields jobs in a order so that for each jop all jobs
397401 it depends on are already finished
398402
403+ :param update_graph: if True, update all nodes/jobs (calling :func:`Job._sis_runnable`)
404+ while running through the graph to get the most current dependency graph.
399405 :return (generator Node): jobs sorted by dependency
400406 """
401407 id_to_job = {}
@@ -406,7 +412,7 @@ def get_job(sis_id):
406412 return id_to_job [sis_id ]
407413
408414 stack = []
409- for job in self .jobs ():
415+ for job in self .jobs (update_graph = update_graph ):
410416 node = get_job (job ._sis_id ())
411417 node .job = job
412418 for i in job ._sis_inputs :
0 commit comments