Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't tokenize --pre=all #43

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point in carrying around the extra data structure of the list.

_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 == []
Loading