Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Feb 3, 2025
1 parent 34c147c commit d102d94
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 9 additions & 7 deletions cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,7 @@ def load_graph(self):
self.workflow_polling_tasks.update(
parser.workflow_state_polling_tasks)
self._proc_triggers(parser, seq, task_triggers)
self.check_outputs(parser.terminals)

self.set_required_outputs(task_output_opt)

Expand All @@ -2275,20 +2276,21 @@ def load_graph(self):
for tdef in self.taskdefs.values():
tdef.tweak_outputs()

def check_outputs(self, tasks_and_ouputs):
def check_outputs(self, terminals):
"""Check that task outputs have been registered with tasks.
TODO - have a bit more of a think about whether the try except is
safe
"""
for task, output in tasks_and_ouputs:
for terminal in terminals:
parts = terminal.split(':')
if len(parts) != 2:
continue
task, output = parts
try:
registered_outputs = self.cfg['runtime'][task]['outputs']
except KeyError:
registered_outputs = []
if (
not TaskOutputs.is_valid_std_name(output)
and output not in registered_outputs
not TaskOutputs.is_valid_std_name(output.strip('?'))
and output.strip('?') not in registered_outputs
):
raise WorkflowConfigError(
f"Undefined custom output: {task}:{output}"
Expand Down
6 changes: 4 additions & 2 deletions cylc/flow/graph_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,12 @@ def parse_graph(self, graph_string: str) -> None:
pairs.add((chain[i], chain[i + 1]))

# Get a set of RH nodes which are not at the LH of another pair:
terminals = {p[1] for p in pairs}.difference({p[0] for p in pairs})
self.terminals = {p[1] for p in pairs}.difference(
{p[0] for p in pairs}
)

for pair in sorted(pairs, key=lambda p: str(p[0])):
self._proc_dep_pair(pair, terminals)
self._proc_dep_pair(pair, self.terminals)

@classmethod
def _report_invalid_lines(cls, lines: List[str]) -> None:
Expand Down

0 comments on commit d102d94

Please sign in to comment.