Skip to end of metadata
Go to start of metadata

How can I automatically kill long-running jobs?

Step-by-step guide

One way of doing this is a combination of the late flag and triggers. This shows an example with/without a script. This example shows both, hence you need to choose one.

suite s 
      task long_running                   # if task takes takes longer than 2 hours set late flag
           late -c +02:00                 
      task kill_long_running              # only triggered if task long_running is late
          trigger long_running<flag>late   
      task kill_long_running_noScript     # only triggered if task long_running is late
          trigger long_running<flag>late  
          edit ECF_NO_SCRIPT 1 
          edit ECF_JOB_CMD "export ECF_PASS=%ECF_PASS%;export ECF_PORT=%ECF_PORT%;export ECF_HOST=%ECF_HOST%;export ECF_NAME=%ECF_NAME%;export ECF_TRYNO=%ECF_TRYNO%; ecflow_client --init=$$; ecflow_client --kill /s/long_running; ecflow_client --complete"

The script for kill_ long_running task

kill_long_running.ecf
<head.h>
ecflow_client --kill /s/long_running
<tail.h>