Open Daviey opened 7 years ago
Duplicate #1944
I'm not quite sure I agree that it is a duplicate, but it is certainly linked. The other issue (#1944) is specifically for System jobs.. this is for scheduled Service jobs.
@Daviey I don't have this use-case right now, but it seems very interesting. What kinds of problems is it meant to address? I could see a fit for dev or test environments that you want to tear down after-hours or on weekends.
@stevenscg At the moment (pre-docker and Nomad), I have lots of cron jobs for starting and killing applications outside of business hours.. I'd like to get away from this... but it is currently really hard to model with Nomad without hacking/fudging it with the description I outlined.
In addition, I could see a use-case for different teams (different apps) having reserved resources between certain hours to make better use of resources.
@redi-walkerd For now I would probably just run a cron that ups/downs the count of the job during the hours you need
We would like this as well. It would be grate if nomad could cron schedule a docker image, so we dont need to build cron into all our images.
We also have a large number of services that should only be run during business hours. During business hours we'd want to retain existing nomad service capabilities such as restarting on task failure, but outside of business hours the service should be prevented from running. Speaking of business hours, a business calendar would also be extremely useful, so we can prevent batch jobs and services from running on holidays. However that's a whole separate issue. I mention it here because it may impact how a feature like this is implemented.
@dadgar
For now I would probably just run a cron that ups/downs the count of the job during the hours you need
When using .hcl Nomadfiles - should I do those changes with sed
on Nomadfiles? Or there is better alternative?
We're also interested in this functionality. Scheduling business hours would be a huge plus for systems that connect to outside services that have defined maintenance systems, like financial exchange gateways.
Noting that the Nomad Autoscaler has an issue which would cover this use case: https://github.com/hashicorp/nomad-autoscaler/issues/448
There's no code in that issue, but there's a reference to a custom plugin repo with a "cron" scheduler: https://github.com/jsiebens/nomad-autoscaler-plugins
We are also looking for such a solution as it is a potential snag in our migration to Nomad. Our use case is similar to @ctc-santanaa operating in a financial services context where there is a well defined "end of day" which can vary per application and region. I have come across some work-arounds but all create a barrier to entry for us to migrate our existing jobs.
Can confirm that this would be a very useful feature for our use-case: trading applications that are only required to be up and running during market hours.
I'd like to be able to run Service jobs on a schedule. These differ from Periodic Batch jobs as they do not have an inbuilt end-state. A good example of this would be running a webserver (such as Apache) between the hours of 9:00-5:00 Monday-Friday.
The two workarounds I can currently think of are:
Service task, with 2 paired Periodic Batch job each to perform a 'nomad run' and 'nomad stop'. This feels pretty dirty and prone to issues, and will get complicated quickly with multiple jobs.
Run the webserver as a Batch job scheduling start, and have an inbuilt script (such as cron) that kills the entrypoint blocking process which terminates the container. This feels dirty because it will not be treated as a service, and the container will not be restarted on an unexpected failure.
I'd like to see a Time Scheduler in the Service job spec, but I i'm struggling to think of a way to express it.. Perhaps following cron standard:
simple start / stop:
Specific hours on days:
Limited days, fixed hours:
multi-day different times (might be a bit of a reach!):