Skip to content

Run threshold: stop the job if runs longer than x minutes #538

Answered by yohamta
kamandir asked this question in Q&A
Discussion options

You must be logged in to vote

Dagu doesn't have max running time option right now (any contribution will be welcomed).
One way to check running time and stop when needed is using bash script. Here's the rough idea.

steps:
  # other steps
  - name: checker
    command: bash
    script: |
     start=`date +%s`
     DAG=/path/to/DAG.yaml
     while :
     do
       isRunning=`dagu status $DAG`
       now=`date +%s`
       if the DAG is finished then exit 0
       if the DAG is running too long then
         dagu stop $DAG
       end
       sleep 1
     done

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by yohamta
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants