Skip to content

Commit

Permalink
Fixed a bug where cylc set ... --pre=all was tokenized leading to
Browse files Browse the repository at this point in the history
a warning that the task was not dependent on "all".
  • Loading branch information
wxtim committed Feb 8, 2024
1 parent 973d53b commit f639513
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cylc/flow/task_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
from cylc.flow.task_events_mgr import TaskEventsManager
from cylc.flow.workflow_db_mgr import WorkflowDatabaseManager
from cylc.flow.flow_mgr import FlowMgr, FlowNums
from typing_extensions import Literal


Pool = Dict['PointBase', Dict[str, TaskProxy]]
Expand Down Expand Up @@ -1719,10 +1720,14 @@ def set_prereqs_and_outputs(
# Illegal flow command opts
return

_prereqs: List[Tokens] = [
Tokens(prereq, relative=True)
for prereq in (prereqs or [])
]
_prereqs: 'Union[List[Tokens], Literal["all"]]'
if prereqs == ['all']:
_prereqs = 'all'
else:
_prereqs = [
Tokens(prereq, relative=True)
for prereq in (prereqs or [])
]

# Get matching pool tasks and future task definitions.
itasks, future_tasks, unmatched = self.filter_task_proxies(
Expand Down Expand Up @@ -1786,7 +1791,7 @@ def _set_outputs_itask(
def _set_prereqs_itask(
self,
itask: 'TaskProxy',
prereqs: List[Tokens],
prereqs: 'Union[List[Tokens], Literal["all"]]',
flow_nums: Set[int],
flow_wait: bool
) -> None:
Expand All @@ -1795,7 +1800,7 @@ def _set_prereqs_itask(
Prerequisite format: "cycle/task:message" or "all".
"""
if prereqs == ["all"]:
if prereqs == "all":
itask.state.set_all_satisfied()
else:
itask.satisfy_me(prereqs)
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/scripts/test_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,15 @@ async def test_incomplete_detection(
async with start(schd) as log:
schd.pool.set_prereqs_and_outputs(['1/one'], ['failed'], None, ['1'])
assert log_filter(log, contains='1/one did not complete')


async def test_pre_all(flow, scheduler, run):
"""Ensure that --pre=all is interpreted as a special case
and _not_ tokenized.
"""
id_ = flow({'scheduling': {'graph': {'R1': 'a => z'}}})
schd = scheduler(id_, paused_start=False)
async with run(schd) as log:
schd.pool.set_prereqs_and_outputs(['1/z'], [], ['all'], ['all'])
warn_or_higher = [i for i in log.records if i.levelno > 20]
assert warn_or_higher == []

0 comments on commit f639513

Please sign in to comment.