Hey, team, How do we tell python subprocess runn...
# ask-metaflow
g
Hey, team, How do we tell python subprocess running metaflow job to kill all the aws batch job initiated by metaflow if parent process is being terminated?
1
a
@gentle-author-38571 if the parent process is interrupted, metaflow tries to kill all the aws batch jobs before terminating. of course, if multiple interrupts happen - we are forced to short circuit the optimistic killing of batch jobs and terminate the process immediately
all batch jobs have a timeout associated with them - default is 5 days - to ensure that they don't end up hogging all your compute resources
g
Thank you @square-wire-39606 for the reply. So we don't have to do anything explicitly? I was trying to send sigint to subprocess. eg. sub_proc.send_signal(signal.SIGINT) in the sigterm handler of main process. We see that after parent process is interrupted, all the sub-sequent steps in the Flow are not submitted. But we are more interested killing steps in 'running' state. Because sometimes those are the steps using heavy resources and we would want them to be killed to save cost.
a
but of course if multiple interrupts are passed, we have to short circuit and exit. you can also explicitly kill running jobs using the cli -
python flow.py batch kill -h
g
Thanks!
python flow.py batch kill
works for us!