1212
1313class SingleCollectScheduling :
1414 """Implement scheduling with a single test collection phase.
15-
15+
1616 This differs from LoadScheduling by:
1717 1. Only collecting tests on the first node
1818 2. Skipping collection on other nodes
1919 3. Not checking for collection equality
20-
20+
2121 This can significantly improve startup time by avoiding redundant collection
2222 and collection verification across multiple worker processes.
2323 """
@@ -72,7 +72,7 @@ def add_node(self, node: WorkerController) -> None:
7272 """Add a new node to the scheduler."""
7373 assert node not in self .node2pending
7474 self .node2pending [node ] = []
75-
75+
7676 # Remember the first node as our collector
7777 if self .first_node is None :
7878 self .first_node = node
@@ -92,10 +92,10 @@ def add_node_collection(
9292 self .log (f"Ignoring collection from node { node .gateway .id } " )
9393
9494 def mark_test_complete (
95- self , node : WorkerController , item_index : int , duration : float = 0
95+ self , node : WorkerController , item_index : int | str , duration : float = 0
9696 ) -> None :
9797 """Mark test item as completed by node."""
98- self .node2pending [node ].remove (item_index )
98+ self .node2pending [node ].remove (int ( item_index ) if isinstance ( item_index , str ) else item_index )
9999 self .check_schedule (node , duration = duration )
100100
101101 def mark_test_pending (self , item : str ) -> None :
@@ -145,11 +145,11 @@ def check_schedule(self, node: WorkerController, duration: float = 0) -> None:
145145 def remove_node (self , node : WorkerController ) -> str | None :
146146 """Remove a node from the scheduler."""
147147 pending = self .node2pending .pop (node )
148-
148+
149149 # If this is the first node (collector), reset it
150150 if node == self .first_node :
151151 self .first_node = None
152-
152+
153153 if not pending :
154154 return None
155155
0 commit comments