@@ -43,37 +43,35 @@ class InvocationJobsSummary(TypedDict, total=False):
4343
4444
4545class WorkflowProgress (Progress ):
46- invocation_state : str = "new"
47- step_count : Optional [int ] = None
48- job_count : int = 0
49- steps_color : str
50- jobs_color : str
51- subworkflows_color : str
52- step_states : Dict = {}
53- num_ok : int = 0
54- num_new : int = 0
55- num_queued : int = 0
56- num_running : int = 0
57- num_errors : int = 0
58- num_paused : int = 0
59-
60- num_subworkflows : int = 0
61- num_subworkflows_complete : int = 0
6246
6347 _jobs_task : TaskID
6448 _steps_task : TaskID
6549 _subworkflows_task : Optional [TaskID ] = None
6650
6751 def __init__ (self , display : DisplayConfiguration ):
52+ self .invocation_state : str = "new"
53+ self .step_count : Optional [int ] = None
54+ self .job_count : Optional [int ] = 0
55+ self .jobs_completed : Optional [int ] = None
56+ self .step_states : Dict [str , int ] = {}
57+ self .num_ok : int = 0
58+ self .num_new : int = 0
59+ self .num_queued : int = 0
60+ self .num_running : int = 0
61+ self .num_errors : int = 0
62+ self .num_paused : int = 0
63+
64+ self .num_subworkflows : int = 0
65+ self .num_subworkflows_complete : int = 0
6866 self .display = display
6967 bar_column = BarColumn (
7068 style = self .display .style_bar_back ,
7169 finished_style = self .display .style_bar_finished ,
7270 complete_style = self .display .style_bar_complete ,
7371 )
74- self .jobs_color = self .display .style_initializing
75- self .steps_color = self .display .style_initializing
76- self .subworkflows_color = self .display .style_initializing
72+ self .jobs_color : str = self .display .style_initializing
73+ self .steps_color : str = self .display .style_initializing
74+ self .subworkflows_color : str = self .display .style_initializing
7775 super ().__init__ (
7876 TextColumn ("[progress.description]{task.description}" ),
7977 TextColumn (display .divider ),
@@ -153,7 +151,7 @@ def handle_invocation(self, invocation: Invocation, job_state_summary: Invocatio
153151 self .jobs_completed = self .num_ok + self .num_errors
154152 self .num_paused = count_states (job_state_summary , ["paused" ])
155153 self .jobs_terminal_count = self .jobs_completed + self .num_paused
156- jobs_total = self .job_count
154+ jobs_total : Optional [ int ] = self .job_count
157155 if self .num_errors > 0 :
158156 self .jobs_color = self .display .style_error
159157 elif self .job_count > 0 :
@@ -251,18 +249,15 @@ def running_count(job_summary: InvocationJobsSummary) -> int:
251249
252250
253251class WorkflowProgressDisplay (Live ):
254- workflow_progress : WorkflowProgress
255- subworkflow_progress : Optional [WorkflowProgress ] = None
256- subworkflow_invocation_ids_seen : Set [str ] = set ()
257- subworkflow_invocation_ids_completed : Set [str ] = set ()
258- invocation_id : str
259- subworkflow_invocation_id : Optional [str ] = None
260252
261253 def __init__ (
262254 self ,
263255 invocation_id : str ,
264256 display_configuration : Optional [DisplayConfiguration ] = None ,
265257 ):
258+ self .subworkflow_invocation_ids_seen : Set [str ] = set ()
259+ self .subworkflow_invocation_ids_completed : Set [str ] = set ()
260+ self .subworkflow_invocation_id : Optional [str ] = None
266261 self .invocation_id = invocation_id
267262 display = display_configuration or DisplayConfiguration ()
268263 self .display = display
@@ -271,10 +266,12 @@ def __init__(
271266 super ().__init__ (self ._panel ())
272267
273268 def _register_subworkflow_invocation_ids_from (self , invocation : Invocation ):
274- subworkflow_invocation_ids = []
275- for step in invocation ["steps" ]:
276- if step .get ("subworkflow_invocation_id" ) is not None :
277- subworkflow_invocation_ids .append (step ["subworkflow_invocation_id" ])
269+ subworkflow_invocation_ids : List [str ] = []
270+ steps = invocation .get ("steps" ) or []
271+ for step in steps :
272+ subworkflow_invocation_id = step .get ("subworkflow_invocation_id" )
273+ if subworkflow_invocation_id :
274+ subworkflow_invocation_ids .append (subworkflow_invocation_id )
278275 self ._register_subworkflow_invocation_ids (subworkflow_invocation_ids )
279276
280277 def _register_subworkflow_invocation_ids (self , ids : List [str ]):
0 commit comments