pregel: update validation error messages (#3517)

OK not including as well, but this was useful for troubleshooting as a
new user (especially before there were any examples)
This commit is contained in:
Nuno Campos
2025-02-25 16:45:57 -08:00
committed by GitHub
+17 -5
View File
@@ -32,11 +32,17 @@ def validate_graph(
for chan in subscribed_channels:
if chan not in channels:
raise ValueError(f"Subscribed channel '{chan}' not in 'channels'")
raise ValueError(
f"Subscribed channel '{chan}' not "
f"in known channels: '{repr(sorted(channels))[:100]}'"
)
if isinstance(input_channels, str):
if input_channels not in channels:
raise ValueError(f"Input channel '{input_channels}' not in 'channels'")
raise ValueError(
f"Input channel '{input_channels}' not "
f"in known channels: '{repr(sorted(channels))[:100]}'"
)
if input_channels not in subscribed_channels:
raise ValueError(
f"Input channel {input_channels} is not subscribed to by any node"
@@ -44,10 +50,13 @@ def validate_graph(
else:
for chan in input_channels:
if chan not in channels:
raise ValueError(f"Input channel '{chan}' not in 'channels'")
raise ValueError(
f"Input channel '{chan}' not in '{repr(sorted(channels))[:100]}'"
)
if all(chan not in subscribed_channels for chan in input_channels):
raise ValueError(
f"None of the input channels {input_channels} are subscribed to by any node"
f"None of the input channels {input_channels} "
f"are subscribed to by any node"
)
all_output_channels = set[str]()
@@ -62,7 +71,10 @@ def validate_graph(
for chan in all_output_channels:
if chan not in channels:
raise ValueError(f"Output channel '{chan}' not in 'channels'")
raise ValueError(
f"Output channel '{chan}' not "
f"in known channels: '{repr(sorted(channels))[:100]}'"
)
if interrupt_after_nodes != "*":
for n in interrupt_after_nodes: