7373
7474from cylc .flow import __version__ as CYLC_VERSION , LOG
7575from cylc .flow .cycling .loader import get_point
76- from cylc .flow .data_messages_pb2 import ( # type: ignore
76+ from cylc .flow .data_messages_pb2 import (
7777 PbEdge , PbEntireWorkflow , PbFamily , PbFamilyProxy , PbJob , PbTask ,
7878 PbTaskProxy , PbWorkflow , PbRuntime , AllDeltas , EDeltas , FDeltas ,
7979 FPDeltas , JDeltas , TDeltas , TPDeltas , WDeltas )
112112
113113if TYPE_CHECKING :
114114 from cylc .flow .cycling import PointBase
115-
115+ from cylc . flow . flow_mgr import FlowNums
116116
117117EDGES = 'edges'
118118FAMILIES = 'families'
@@ -713,10 +713,10 @@ def generate_definition_elements(self):
713713 def increment_graph_window (
714714 self ,
715715 source_tokens : Tokens ,
716- point ,
717- flow_nums ,
718- is_manual_submit = False ,
719- itask = None
716+ point : 'PointBase' ,
717+ flow_nums : 'FlowNums' ,
718+ is_manual_submit : bool = False ,
719+ itask : Optional [ 'TaskProxy' ] = None
720720 ) -> None :
721721 """Generate graph window about active task proxy to n-edge-distance.
722722
@@ -731,16 +731,12 @@ def increment_graph_window(
731731 assessed for pruning eligibility.
732732
733733 Args:
734- source_tokens (cylc.flow.id.Tokens)
735- point (PointBase)
736- flow_nums (set)
737- is_manual_submit (bool)
738- itask (cylc.flow.task_proxy.TaskProxy) :
734+ source_tokens
735+ point
736+ flow_nums
737+ is_manual_submit
738+ itask:
739739 Active/Other task proxy, passed in with pool invocation.
740-
741- Returns:
742- None
743-
744740 """
745741
746742 # common refrences
@@ -1149,28 +1145,23 @@ def add_pool_node(self, name, point):
11491145 def generate_ghost_task (
11501146 self ,
11511147 tokens : Tokens ,
1152- point ,
1153- flow_nums ,
1154- is_parent = False ,
1155- itask = None ,
1156- n_depth = 0 ,
1157- ):
1148+ point : 'PointBase' ,
1149+ flow_nums : 'FlowNums' ,
1150+ is_parent : bool = False ,
1151+ itask : Optional [ 'TaskProxy' ] = None ,
1152+ n_depth : int = 0 ,
1153+ ) -> None :
11581154 """Create task-point element populated with static data.
11591155
11601156 Args:
1161- source_tokens (cylc.flow.id.Tokens)
1162- point (PointBase)
1163- flow_nums (set)
1164- is_parent (bool) :
1157+ source_tokens
1158+ point
1159+ flow_nums
1160+ is_parent:
11651161 Used to determine whether to load DB state.
1166- itask (cylc.flow.task_proxy.TaskProxy) :
1162+ itask:
11671163 Update task-node from corresponding task proxy object.
1168- n_depth (int): n-window graph edge distance.
1169-
1170- Returns:
1171-
1172- None
1173-
1164+ n_depth: n-window graph edge distance.
11741165 """
11751166 tp_id = tokens .id
11761167 if (
@@ -1486,7 +1477,11 @@ def apply_task_proxy_db_history(self):
14861477
14871478 self .db_load_task_proxies .clear ()
14881479
1489- def _process_internal_task_proxy (self , itask , tproxy ):
1480+ def _process_internal_task_proxy (
1481+ self ,
1482+ itask : 'TaskProxy' ,
1483+ tproxy : PbTaskProxy ,
1484+ ):
14901485 """Extract information from internal task proxy object."""
14911486
14921487 update_time = time ()
@@ -1569,6 +1564,7 @@ def insert_job(self, name, cycle_point, status, job_conf):
15691564 cycle = str (cycle_point ),
15701565 task = name ,
15711566 )
1567+ tproxy : Optional [PbTaskProxy ]
15721568 tp_id , tproxy = self .store_node_fetcher (tp_tokens )
15731569 if not tproxy :
15741570 return
@@ -1642,6 +1638,7 @@ def insert_db_job(self, row_idx, row):
16421638 cycle = point_string ,
16431639 task = name ,
16441640 )
1641+ tproxy : Optional [PbTaskProxy ]
16451642 tp_id , tproxy = self .store_node_fetcher (tp_tokens )
16461643 if not tproxy :
16471644 return
@@ -1761,9 +1758,8 @@ def update_workflow_states(self):
17611758 self .apply_delta_checksum ()
17621759 self .publish_deltas = self .get_publish_deltas ()
17631760
1764- def window_resize_rewalk (self ):
1761+ def window_resize_rewalk (self ) -> None :
17651762 """Re-create data-store n-window on resize."""
1766- tokens : Tokens
17671763 # Gather pre-resize window nodes
17681764 if not self .all_n_window_nodes :
17691765 self .all_n_window_nodes = set ().union (* (
@@ -1777,7 +1773,8 @@ def window_resize_rewalk(self):
17771773 self .n_window_node_walks .clear ()
17781774 for tp_id in self .all_task_pool :
17791775 tokens = Tokens (tp_id )
1780- tp_id , tproxy = self .store_node_fetcher (tokens )
1776+ tproxy : PbTaskProxy
1777+ _ , tproxy = self .store_node_fetcher (tokens )
17811778 self .increment_graph_window (
17821779 tokens ,
17831780 get_point (tokens ['cycle' ]),
@@ -2279,6 +2276,7 @@ def delta_task_state(self, itask):
22792276 objects from the workflow task pool.
22802277
22812278 """
2279+ tproxy : Optional [PbTaskProxy ]
22822280 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
22832281 if not tproxy :
22842282 return
@@ -2331,7 +2329,7 @@ def delta_task_held(
23312329 task = name ,
23322330 cycle = str (cycle ),
23332331 )
2334-
2332+ tproxy : Optional [ PbTaskProxy ]
23352333 tp_id , tproxy = self .store_node_fetcher (tokens )
23362334 if not tproxy :
23372335 return
@@ -2351,6 +2349,7 @@ def delta_task_queued(self, itask: TaskProxy) -> None:
23512349 objects from the workflow task pool.
23522350
23532351 """
2352+ tproxy : Optional [PbTaskProxy ]
23542353 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
23552354 if not tproxy :
23562355 return
@@ -2370,6 +2369,7 @@ def delta_task_runahead(self, itask: TaskProxy) -> None:
23702369 objects from the workflow task pool.
23712370
23722371 """
2372+ tproxy : Optional [PbTaskProxy ]
23732373 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
23742374 if not tproxy :
23752375 return
@@ -2393,6 +2393,7 @@ def delta_task_output(
23932393 objects from the workflow task pool.
23942394
23952395 """
2396+ tproxy : Optional [PbTaskProxy ]
23962397 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
23972398 if not tproxy :
23982399 return
@@ -2419,6 +2420,7 @@ def delta_task_outputs(self, itask: TaskProxy) -> None:
24192420 objects from the workflow task pool.
24202421
24212422 """
2423+ tproxy : Optional [PbTaskProxy ]
24222424 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
24232425 if not tproxy :
24242426 return
@@ -2444,6 +2446,7 @@ def delta_task_prerequisite(self, itask: TaskProxy) -> None:
24442446 objects from the workflow task pool.
24452447
24462448 """
2449+ tproxy : Optional [PbTaskProxy ]
24472450 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
24482451 if not tproxy :
24492452 return
@@ -2472,13 +2475,14 @@ def delta_task_ext_trigger(
24722475 """Create delta for change in task proxy external_trigger.
24732476
24742477 Args:
2475- itask (cylc.flow.task_proxy.TaskProxy) :
2478+ itask:
24762479 Update task-node from corresponding task proxy
24772480 objects from the workflow task pool.
2478- trig (str) : Trigger ID.
2479- message (str) : Trigger message.
2481+ trig: Trigger ID.
2482+ message: Trigger message.
24802483
24812484 """
2485+ tproxy : Optional [PbTaskProxy ]
24822486 tp_id , tproxy = self .store_node_fetcher (itask .tokens )
24832487 if not tproxy :
24842488 return
0 commit comments