cylc / cylc-flow

Cylc: a workflow engine for cycling systems.
https://cylc.github.io
GNU General Public License v3.0
335 stars 94 forks source link

command validation: broadcasts #6429

Open oliver-sanders opened 1 month ago

oliver-sanders commented 1 month ago

If you try to broadcast an invalid configuration on the CLI, you get a helpful error:

$ cylc broadcast generic -s 'elephant = shrew'
IllegalItemError: elephant

However, if you try to broadcast an invalid configuration from the GUI, you get no error, and a cryptic message in the log:

2024-10-17T15:14:55Z INFO - Command "broadcast" received.
    broadcast(cycle_points=['*'], mode=put_broadcast, namespaces=[None], settings=[{'elephant': 'shrew'}])
Traceback (most recent call last):
...
graphql.error.located_error.GraphQLLocatedError: elephant

2024-10-17T15:14:55Z ERROR - elephant
2024-10-17T15:14:55Z ERROR - graphql.error.located_error.GraphQLLocatedError: elephant

The broadcast command is unlike other commands in that it is performed entirely at command queue time (broadcasts aren't queued to be processed later). It's also implemented outside of cylc.flow.commands for historical reasons.

Suggest moving the broadcast code into cylc.flow.commands (so it runs like a normal command) as this will give it the same error handling as other commands. But keep it all queue-time. Doing this should also forward the error to the client.