utask icon indicating copy to clipboard operation
utask copied to clipboard

Periodic task run (cron)

Open loopfz opened this issue 5 years ago • 1 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I'd like to be able to configure periodic execs for a given template + set of input.

Describe the solution you'd like A clear and concise description of what you want to happen.

Periodic execs definition:

  • every X minute/hour/day
  • or everyday at 3pm
  • or every 3rd of each month at 2pm
  • or ... with template: create-new-thing-XXX with inputs: foo: yyy baz: xxxx bar: zzzz

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

loopfz avatar Jan 23 '20 13:01 loopfz

@loopfz A Cron job like experience can already be achieved with a task (http request to the http://localhost:8081/task) endpoint within the template to schedule the next execution. The parameters of the current execution can be passed through to the next schedule via go template syntax in the body of the request, e.g.

scheduleNextJobExecution:
    description: Schedule next job execution
    action:
      type: http
      configuration:
        url: http://localhost:8081/task
        method: POST
        body: '{"delay": {{ .input.delay }}, "input": {{ toJson .input }}, "template_name": "template-name" }'
    conditions:
    - type: skip
      if:
      - value: '{{ .input.enable_reschedule }}'
        operator: EQ
        expected: false
      then:
        this: DONE
      message: No rescheduling

The timer functionality e.g. hourly, can be achieved with a delay of "1h". To achieve scheduling at a specific point in time e.g. "at 03:00 AM" the initial task have to be delayed to the desired point in time.

vexvec avatar May 28 '21 15:05 vexvec