Skip to content

Commit f189d6e

Browse files
authored
Merge pull request #7019 from cylc/8.6.x-sync
🤖 Merge 8.6.x-sync into master
2 parents 3302cbf + 71d14b1 commit f189d6e

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

cylc/flow/config.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,28 +2394,29 @@ def load_graph(self):
23942394

23952395
self.set_required_outputs(task_output_opt)
23962396

2397-
# Print inferred output optionality, for debugging graph parser.
2398-
# Note this excludes tasks that just default to success-required.
2399-
optionals = [
2400-
f" \u2022 {name}:{output}"
2401-
for (name, output), (optional, _, _) in task_output_opt.items()
2402-
if optional
2403-
]
2404-
requireds = [
2405-
f" \u2022 {name}:{output}"
2406-
for (name, output), (optional, _, _) in task_output_opt.items()
2407-
if not optional
2408-
]
2409-
if optionals:
2410-
LOG.debug(
2411-
"Optional outputs inferred from the graph:\n"
2412-
f"{'\n'.join(optionals)}"
2413-
)
2414-
if requireds:
2415-
LOG.debug(
2416-
"Required outputs inferred from the graph:\n"
2417-
f"{'\n'.join(requireds)}"
2418-
)
2397+
if cylc.flow.flags.verbosity > 1:
2398+
# Print inferred output optionality for debugging the graph parser.
2399+
# (This does not includes tasks that default to success-required.)
2400+
optionals = [
2401+
f" \u2022 {name}:{output}"
2402+
for (name, output), (optional, _, _) in task_output_opt.items()
2403+
if optional
2404+
]
2405+
requireds = [
2406+
f" \u2022 {name}:{output}"
2407+
for (name, output), (optional, _, _) in task_output_opt.items()
2408+
if not optional
2409+
]
2410+
if optionals:
2411+
LOG.debug(
2412+
"Optional outputs inferred from the graph:\n"
2413+
f"{'\n'.join(optionals)}"
2414+
)
2415+
if requireds:
2416+
LOG.debug(
2417+
"Required outputs inferred from the graph:\n"
2418+
f"{'\n'.join(requireds)}"
2419+
)
24192420

24202421
# Detect use of xtrigger names with '@' prefix (creates a task).
24212422
overlap = set(self.taskdefs.keys()).intersection(

tests/integration/test_optional_outputs.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ async def test_optional_outputs_consistency(flow, validate, graph, err):
752752
{
753753
("a", "succeeded"): True, # inferred
754754
("m1", "succeeded"): True, # default
755-
("m2", "succeeded"): False, # inferred (override default)
755+
("m2", "succeeded"): False, # explicit "?"
756756
},
757757
),
758758
pytest.param(
@@ -802,7 +802,7 @@ async def test_optional_outputs_consistency(flow, validate, graph, err):
802802
""",
803803
{
804804
("a", "succeeded"): True, # inferred
805-
("b", "succeeded"): False, # inferred
805+
("b", "succeeded"): False, # explicit "?"
806806
("c", "succeeded"): True, # default
807807
},
808808
),
@@ -813,7 +813,7 @@ async def test_optional_outputs_consistency(flow, validate, graph, err):
813813
{
814814
("a", "succeeded"): True, # inferred
815815
("c", "succeeded"): True, # default
816-
("c", "x"): True, # inferred
816+
("c", "x"): True, # explicit ":x"
817817
},
818818
),
819819
pytest.param(
@@ -823,7 +823,7 @@ async def test_optional_outputs_consistency(flow, validate, graph, err):
823823
{
824824
("a", "succeeded"): True, # inferred
825825
("c", "succeeded"): True, # default
826-
("c", "x"): False, # inferred
826+
("c", "x"): False, # explicit ":x?"
827827
},
828828
),
829829
pytest.param(
@@ -880,14 +880,15 @@ async def test_optional_outputs_inference(
880880
},
881881
}
882882
)
883+
883884
config = validate(id)
884885
for (task, output), exp in expected.items():
885886
tdef = config.get_taskdef(task)
886887
(_, required) = tdef.outputs[output]
887888
assert required == exp
888889

889890

890-
async def test_log_outputs(flow, validate, caplog):
891+
async def test_log_outputs(flow, validate, caplog, monkeypatch):
891892
"""Test logging of optional and required outputs inferred from the graph.
892893
893894
This probes output optionality inferred by the graph parser, so it does
@@ -921,6 +922,9 @@ async def test_log_outputs(flow, validate, caplog):
921922
}
922923
}
923924
)
925+
926+
monkeypatch.setattr('cylc.flow.flags.verbosity', 2)
927+
924928
caplog.set_level(logging.DEBUG)
925929
validate(id)
926930

0 commit comments

Comments
 (0)