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

periodic job start at a later date and time #12796

Open
shantanugadgil opened this issue Apr 27, 2022 · 3 comments
Open

periodic job start at a later date and time #12796

shantanugadgil opened this issue Apr 27, 2022 · 3 comments
Labels
stage/needs-discussion theme/batch Issues related to batch jobs and scheduling type/enhancement

Comments

@shantanugadgil
Copy link
Contributor

shantanugadgil commented Apr 27, 2022

Proposal

The current meaning of a batch job is to be "enabled" from the moment the job is run, i.e. "now".
The use case for this is primarily in context of periodic (cron) jobs, but can also be thought of for regular batch jobs.

I propose, two new fields for the job which can be used to activate (or enable) the batch job from a future date and also be able to govern when the job ends, i.e. not run past a certain time.

Current stanza:

  type = "batch"

  periodic {
    cron             = "*/15 * * * * *"
  }

Proposed solution:

  type = "batch"

  start_at = "2022-MAY-04"    # timestamp can be a standard format, strings used here only for sake of clarity.
  end_at   = "2022-JUNE-04"

  periodic {
    cron             = "*/15 * * * * *"
  }

Use-cases

The use case is to be able to have a job be "run" now, but not activate (i.e. start) until a future date.

Attempted Solutions

  1. For a time spec which repeats within a day, this can be achieved by submitting three separate jobs (but seems hacky):
  • from the specified date to end of the month.
  • from the subsequent month to the end of the year.
  • from the subsequent year to the end-of-time.
  1. Submit two jobs, one which runs at the specific time (2022-MAY-04) which in turn submits the actual simple periodic job. (this too seems hacky).
    A third job can be scheduled to run on 2022-JUNE-04, which does a stop -purge on the first job.
@shantanugadgil
Copy link
Contributor Author

seems sort of related to #2395

@lgfa29 lgfa29 added stage/needs-discussion theme/batch Issues related to batch jobs and scheduling labels Apr 27, 2022
@lgfa29
Copy link
Contributor

lgfa29 commented Apr 27, 2022

Thanks for the idea @shantanugadgil.

I think this (and #2395) could also be related to hashicorp/nomad-autoscaler#448, where this behaviour could achieved using the Autoscaler. I will put this for further discussion and triage.

Anyone else interested in this feature please give it a 👍 to help us gauge interest 🙂

@josegonzalez
Copy link
Contributor

I would love this sort of functionality. At SeatGeek, we have jobs that need to be run during certain seasons - say, run a report for all NFL purchases during the season - and then don't need to run afterwards. Currently, we delete the jobs from Nomad, but then need to remember to re-add it. Would be great to be able to have that handled in the registered Nomad job itself.

Not sure what the format would/should be - dates are fine, but potentially there is a more flexible format for periods of time - but it should probably be inside of the periodic stanza and not at the job level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-discussion theme/batch Issues related to batch jobs and scheduling type/enhancement
Projects
Status: Needs Roadmapping
Development

No branches or pull requests

3 participants