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

Better queue config warning. #3618

Merged
merged 3 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ files are now auto-documented from their definitions.

### Fixes

[#3618](https://github.com/cylc/cylc-flow/pull/3618) - Clear queue configuration
warnings for referencing undefined or unused tasks.

[#3596](https://github.com/cylc/cylc-flow/pull/3596) - Fix a bug that could
prevent housekeeping of the task_action_timers DB table and cause many warnings
at restart.
Expand Down
6 changes: 5 additions & 1 deletion cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,12 @@ def configure_queues(self):
'already assigned to a queue')
warnings.append(msg)
elif qmember not in all_task_names:
if qmember not in self.cfg['runtime']:
err = 'task not defined'
else:
err = 'task not used in the graph'
msg = "%s: ignoring %s (%s)" % (
key, qmember, 'task not defined')
key, qmember, err)
warnings.append(msg)
else:
# Ignore: task not used in the graph.
Expand Down
30 changes: 29 additions & 1 deletion cylc/flow/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ def test_family_inheritance_and_quotes(self):
config.runtime['descendants']['SOMEFAM']


def test_queue_config(caplog, tmp_path):
def test_queue_config_repeated(caplog, tmp_path):
"""Test repeated assignment to same queue."""
suiterc_content = """
[scheduling]
[[queues]]
Expand All @@ -236,3 +237,30 @@ def test_queue_config(caplog, tmp_path):
log = caplog.messages[0].split('\n')
assert log[0] == "Queue configuration warnings:"
assert log[1] == "+ q2: ignoring x (already assigned to a queue)"


def test_queue_config_not_used_not_defined(caplog, tmp_path):
"""Test task not defined vs no used, in queue config."""
suiterc_content = """
[scheduling]
[[queues]]
[[[q1]]]
members = foo
[[[q2]]]
members = bar
[[dependencies]]
# foo and bar not used
graph = "beef => wellington"
Copy link
Member

Choose a reason for hiding this comment

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

🍌

[runtime]
[[beef]]
[[wellington]]
[[foo]]
# bar not even defined
"""
suite_rc = tmp_path / "suite.rc"
suite_rc.write_text(suiterc_content)
config = SuiteConfig(suite="qtest", fpath=suite_rc.absolute())
log = caplog.messages[0].split('\n')
assert log[0] == "Queue configuration warnings:"
assert log[1] == "+ q1: ignoring foo (task not used in the graph)"
assert log[2] == "+ q2: ignoring bar (task not defined)"