Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 show shows both, hence you need to choose one.

Code Block
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=$$; %ECFecflow_CLIENT%client --kill /s/long_running; %ECFecflow_CLIENT%client --complete"

The script for kill_ long_running task

...