feat(dag_engine): implement cascade_blocks and call in ExecutionEngine.tick
This commit is contained in:
@@ -16,6 +16,23 @@ class TrackDAG:
|
||||
self.tickets = tickets
|
||||
self.ticket_map = {t.id: t for t in tickets}
|
||||
|
||||
def cascade_blocks(self) -> None:
|
||||
"""
|
||||
Transitively marks `todo` tickets as `blocked` if any dependency is `blocked`.
|
||||
Runs until stable (handles multi-hop chains: A→B→C where A blocked cascades to B then C).
|
||||
"""
|
||||
changed = True
|
||||
while changed:
|
||||
changed = False
|
||||
for ticket in self.tickets:
|
||||
if ticket.status == 'todo':
|
||||
for dep_id in ticket.depends_on:
|
||||
dep = self.ticket_map.get(dep_id)
|
||||
if dep and dep.status == 'blocked':
|
||||
ticket.status = 'blocked'
|
||||
changed = True
|
||||
break
|
||||
|
||||
def get_ready_tasks(self) -> List[Ticket]:
|
||||
"""
|
||||
Returns a list of tickets that are in 'todo' status and whose dependencies are all 'completed'.
|
||||
@@ -116,6 +133,7 @@ class ExecutionEngine:
|
||||
Returns:
|
||||
A list of ready Ticket objects.
|
||||
"""
|
||||
self.dag.cascade_blocks()
|
||||
ready = self.dag.get_ready_tasks()
|
||||
if self.auto_queue:
|
||||
for ticket in ready:
|
||||
|
||||
Reference in New Issue
Block a user