Stop Chain
RespondidaHow to use the Stop Chain command in Chains?
-
Hi Daniela Smits, the Stop Chain command allows you to programmatically stop a currently running Chain from withing your Chain logic. This is useful when you want to end a Chain run based on a condition, validation failure, or other runtime logic. To use the Command, you must provide the ID of a running Chain that you want to stop.
0What would you recommend is a way to implement it for the purpose of stopping chains that run for a prolonged period without failing/erroring? Would this be implemented in each chain or as a separate chain that tracks all other chains?
0Hi Daniela Smits,
There are a few ways you could implement this. One approach would be to create a dedicated "monitor" Chain. At the start of a long running Chain, you could launch the monitor Chain using a Run Chain event and pass it the ID of the running Chain to monitor. The monitor Chain could periodically check whether the target Chain is still running and, if it exceeds a defined timeout threshold, use the Stop Chain command to stop it.
I would also recommend investigating the root cause of the prolonged execution. Determine whether the Chain is still actively processing data or if it has entered a hung state where it is no longer making progress but also isn't failing. The Stop Chain command can be used as a safeguard to terminate long running executions, but identifying and addressing the underlying cause will help prevent the issue from recurring.
0Thank you! Last question, which chain Id needs to be used? The chain run id (unique to each run) or the chain ID that is fixed?
0You will need to use the ID of the Chain run and not the Chain ID. You can get the ID of the Chain run in Runtime variables and using the 'Chain.ExecutorId' variable.
0Por favor, entrar para comentar.
Comentários
5 comentários