treasure-data / digdag

Workload Automation System
https://www.digdag.io/
Apache License 2.0
1.31k stars 222 forks source link

set SLA for each task #689

Closed ikzhr closed 6 years ago

ikzhr commented 6 years ago

Hi, I've started to use digdag yesterday and I'm pleased with this awesome software. However, when I set SLAs for tasks, I met a problem so let me ask questions below.

  1. Is there any way to set SLA for each task?
  2. If not, is there any plan to implement this (kind of) feature?

example:

sla:
  duration: 00:00:10
  +notice:
    echo>: Tasks have not finished yet.

+task1:
  sla:
    duration: 00:00:02
    +notice:
      echo>: ${task_name} has not finished yet.
  sh>: sleep 3

+task2:
  sla:
    duration: 00:00:05
    +notice:
      echo>: ${task_name} has not finished yet.
  sh>: sleep 3

There are three SLAs in the example above and I expected the +task1 will fail to achieve the SLA(=2sec). However, only the first definition(=10sec) seems to be valid as SLA in the current implementation.

hiroyuki-sato commented 6 years ago

Hello, @ikzhr

Have you ever tried require>? (or call> operator`) I made one example. It splits single workflow into multiple workflows.

sla_task.dig

timezone: UTC

+require1:
  require>: prev_task1
  session_time: ${moment().startOf('days').format()}

+require2:
  require>: prev_task2
  session_time: ${moment().startOf('days').format()}

prev_task1.dig

timezone: UTC

sla:
  duration: 00:00:10
  +notice:
    echo>: prev_task1 not finished

+task1:
  sh>: sleep 15 ; echo This is prev_task1

prev_task2.dig

timezone: UTC

sla:
  duration: 00:00:10
  +notice:
    echo>: prev_task2 not finished

+task2:
  sh>: sleep 15 ; echo This is prev_task2

See also:

komamitsu commented 6 years ago

sla is defined on each workflow, so you can't set sla for each task.

As @hiroyuki-sato suggested, require operator creates another workflow (== session) dynamically and you can define another sla for it.

ikzhr commented 6 years ago

@hiroyuki-sato @komamitsu require operator works as desired so I'll use it. Thanks for your suggestions and comments! 🙇