#Cancel a running Build

1 messages · Page 1 of 1 (latest)

woeful raft
#

Is it possible to cancel a running Pipeline with the Node JS SDK?

Thank you for your support?salute

woeful lintel
#

hey! if you press ctrl+c (SIGTERM) when the pipeline is running, it should cancel it

woeful raft
#

Hello 🙂 Yes this works but is there a way to cancel it pragmatically?

woeful lintel
#

yes, which SDK are you using?

#

oh, I see node

#

hmm in Go this is possible via context cancellations, not sure if that's possible with the promises and async/await functions in Node and Python. Any clues @vapid tree @tulip rain ?

tulip rain
#

What is your use case? May we can find a workaround

woeful raft
#

We run automated builds and have a UI where developers can manage their builds and we would like to give the option to cancel a build.

#

If one takes too long and blocks new ones to use the resources

woeful lintel
#

@woeful raft @tulip rain maybe one way to achieve this could be to start the dagger pipeline via a fork call and then just send a kill message whenever you want to stop it. I'd think that should work ok. Not sure if you've made any progress here @woeful raft !

tulip rain
woeful raft
#

The fork approach seems good to me I will test that. Would something like p-timeout also work or dose this just stop awaiting the promise after the timeout.
https://www.npmjs.com/package/p-timeout

woeful lintel
#

it really depends on how you're triggering your build. I

pine umbra
# woeful lintel yes, this won't work unfortunately since the promise will still keep executing a...

What happens when we reject the „parent“ promise using token cancellation (https://stackoverflow.com/a/30235261 )? Would dagger stop building?
@woeful raft

woeful lintel
pine umbra
woeful raft
#

We tried some stuff with fork but this does not feel really clean because we can only start files. Do you know of library that can start a function in a sub process? We tried serializing the function and passing it via IPC to the child process where it was deserialized but we could not import the dagger sdk from there.

woeful lintel
#

this way you won't find yourself in this situation of trying to implement an RPC style thing

#

Do you know of library that can start a function in a sub process?E
I haven't personally seen any

woeful lintel