Skip to content

Commit

Permalink
Merge pull request #3618 from hjoliver/qwarning
Browse files Browse the repository at this point in the history
Better queue config warning.
  • Loading branch information
oliver-sanders authored May 21, 2020
2 parents b4cd626 + c06447d commit d7caab4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
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"
[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)"

0 comments on commit d7caab4

Please sign in to comment.