Skip to content

Commit

Permalink
Fix cylc show satisfied xtriggers info
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsutherland committed Oct 24, 2023
1 parent 38cedcd commit 2e4b96d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cylc/flow/data_store_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
from time import time
from typing import (
Any,
Dict,
Optional,
Set,
TYPE_CHECKING,
Tuple,
Union,
Expand Down Expand Up @@ -481,7 +483,7 @@ def __init__(self, schd):
state: deque(maxlen=LATEST_STATE_TASKS_QUEUE_SIZE)
for state in TASK_STATUSES_ORDERED
}
self.xtrigger_tasks = {}
self.xtrigger_tasks: Dict[str, Set[Tuple[str, str]]] = {}
# Managed data types
self.data = {
self.workflow_id: deepcopy(DATA_TEMPLATE)
Expand Down Expand Up @@ -1315,7 +1317,7 @@ def _process_internal_task_proxy(self, itask, tproxy):
xtrig.id = sig
xtrig.label = label
xtrig.satisfied = satisfied
self.xtrigger_tasks.setdefault(sig, set()).add(tproxy.id)
self.xtrigger_tasks.setdefault(sig, set()).add((tproxy.id, label))

if tproxy.state in self.latest_state_tasks:
tp_ref = itask.identity
Expand Down Expand Up @@ -1592,7 +1594,9 @@ def prune_data_store(self):
node_ids.remove(tp_id)
continue
for sig in node.xtriggers:
self.xtrigger_tasks[sig].remove(tp_id)
self.xtrigger_tasks[sig].remove(

Check warning on line 1597 in cylc/flow/data_store_mgr.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/data_store_mgr.py#L1597

Added line #L1597 was not covered by tests
(tp_id, node.xtriggers[sig].label)
)
if not self.xtrigger_tasks[sig]:
del self.xtrigger_tasks[sig]

Expand Down Expand Up @@ -2176,6 +2180,7 @@ def delta_task_ext_trigger(
tp_id, PbTaskProxy(id=tp_id))
tp_delta.stamp = f'{tp_id}@{update_time}'
ext_trigger = tp_delta.external_triggers[trig]
ext_trigger.id = tproxy.external_triggers[trig].id

Check warning on line 2183 in cylc/flow/data_store_mgr.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/data_store_mgr.py#L2183

Added line #L2183 was not covered by tests
ext_trigger.message = message
ext_trigger.satisfied = satisfied
ext_trigger.time = update_time
Expand All @@ -2193,12 +2198,14 @@ def delta_task_xtrigger(self, sig, satisfied):
"""
update_time = time()
for tp_id in self.xtrigger_tasks.get(sig, set()):
for tp_id, label in self.xtrigger_tasks.get(sig, set()):
# update task instance
tp_delta = self.updated[TASK_PROXIES].setdefault(
tp_id, PbTaskProxy(id=tp_id))
tp_delta.stamp = f'{tp_id}@{update_time}'
xtrigger = tp_delta.xtriggers[sig]
xtrigger.id = sig
xtrigger.label = label
xtrigger.satisfied = satisfied
xtrigger.time = update_time
self.updates_pending = True
Expand Down

0 comments on commit 2e4b96d

Please sign in to comment.