https://dagster.io/ logo
Title
s

Sara

08/25/2021, 8:37 AM
Hi! I would need help with the following question: Is there a way to stop running a pipeline with a sensor? I need to be able to stop the execution of a pipe based on the value of an external factor. Example: @solid def task1(): number = 1 return number @solid def task2(number): number2 = number + 1 return number2 @pipeline def my_number_pipeline(): task2(task1()) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' external_factor = 0 if external_factor > 0 stop pipeline ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Thanks!!!
d

daniel

08/25/2021, 1:41 PM
Hi Sara - currently sensors can only be used to launch pipelines - we don't have a way to have a sensor that stops a pipeline. (I could imagine writing a pipeline B that stops another pipeline A, and launching pipeline B from your sensor, but that sounds pretty convoluted and is probably not what you want) We do have a GraphQL API that terminates a running pipeline: https://docs.dagster.io/concepts/dagit/graphql#terminate-a-running-pipeline , but you would probably want to handle triggering that termination yourself rather than using sensors.
s

Sara

08/26/2021, 6:17 AM
Hi Daniel! Thanks for your reply and congratulations for your great work. If I wanted to run a pipelineB that stops the pipelineA, how could I do? Best regards!
d

daniel

08/26/2021, 10:58 AM
You could write a solid that makes a graphql call to your dagit server, using the graphql API from the docs link I posted above.