Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jobspec: time based task execution #22201

Merged
merged 4 commits into from
May 22, 2024
Merged

jobspec: time based task execution #22201

merged 4 commits into from
May 22, 2024

Conversation

gulducat
Copy link
Member

@gulducat gulducat commented May 22, 2024

this is the CE side of an Enterprise-only feature. a job trying to use this in CE will fail to validate.

to enable daily-scheduled execution entirely client-side, a job may now contain:

task "name" {
  schedule {
    cron {
      start    = "0 12 * * * *" # may not include "," or "/"
      end      = "0 16"         # partial cron, with only {minute} {hour}
      timezone = "EST"          # anything in your tzdata
    }
  }
...

and everything about the allocation will be placed as usual, but if outside the specified schedule, the taskrunner will block on the client, waiting on the schedule start, before proceeding with the task driver execution, etc.

this includes a taksrunner hook, which watches for the end of the schedule, at which point it will kill the task.

then, restarts-allowing, a new task will start and again block waiting for start, and so on.

this also includes all the plumbing required to pipe API calls through from command->api->agent->server->client, so that tasks can be force-run, force-paused, or resume the schedule on demand.

this is the CE side of an Enterprise-only feature.
a job trying to use this in CE will fail to validate.

to enable daily-scheduled execution entirely client-side,
a job may now contain:

task "name" {
  schedule {
    cron {
      start    = "0 12 * * * *" # may not include "," or "/"
      end      = "0 4" # partial cron, with only {minute} {hour}
      timezone = "EST" # anything in your tzdata
    }
  }
...

and everything about the allocation will be scheduled as usual,
but if outside the schedule, the taskrunner will block,
waiting on the schedule start, before proceeding with the task
driver execution, etc.

this includes a taksrunner hook, which watches for the end
of the schedule, at which point it will kill the task.

then, restarts-allowing, a new task will start and again block
waiting for start, and so on.

this also includes all the plumbing required to pipe API calls
through from command->api->agent->server->client, so that tasks
can be force-run, force-paused, or resume the schedule on demand.

Co-Authored-By: Michael Schurter <[email protected]>
Co-Authored-By: Seth Hoenig <[email protected]>
Copy link
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blockers!

api/allocations.go Outdated Show resolved Hide resolved
client/allocrunner/taskrunner/task_runner.go Outdated Show resolved Hide resolved
client/allocrunner/taskrunner/task_runner.go Outdated Show resolved Hide resolved
client/allocrunner/taskrunner/task_runner_hooks.go Outdated Show resolved Hide resolved
helpText := `
Usage: nomad alloc pause [options] <allocation> <task>

Set the pause state of an allocation. This command is used to suspend the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself that we should make sure this help matches the docs (once I write them!)

command/alloc_pause.go Outdated Show resolved Hide resolved
command/alloc_pause_test.go Outdated Show resolved Hide resolved
nomad/structs/job.go Outdated Show resolved Hide resolved
nomad/structs/structs.go Outdated Show resolved Hide resolved
nomad/structs/task_sched.go Show resolved Hide resolved
@schmichael
Copy link
Member

Don't forget a changelog entry

Co-authored-by: Michael Schurter <[email protected]>
* Fragment and init

* 4-state 2-button alert box

* Small cleanup
Copy link

Ember Test Audit comparison

main 256fd99 change
passes 1559 1562 +3
failures 0 0 0
flaky 0 0 0
duration 11m 21s 892ms 11m 22s 234ms +342ms

@gulducat gulducat merged commit 4415fab into main May 22, 2024
29 checks passed
@gulducat gulducat deleted the f-time-based-task-execution branch May 22, 2024 20:40
Copy link

github-actions bot commented Jan 7, 2025

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants