-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add support for swarm jobs #40307
Add support for swarm jobs #40307
Conversation
Mostly running this PR as WIP because my local dev box is giving me trouble, and I want to run against CI a bit to see if the problem is more general. |
fff938e
to
bb94bda
Compare
c930baa
to
dbd0ef6
Compare
It seems that in CI, the Jobs test takes too long to complete 20 iterations. I've cut down the total to 7, which is less than the minimum completion I saw, which was 8. |
@derny this needs a rebase now |
@thaJeztah Yes, it does, but in any case, the development on Jobs has happened all in a feature branch in Swarmkit, and that feature branch has not quite yet been merged into swarmkit master. |
No longer WIP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when requested number of completions is hit and there are still others running?
Swarmkit will only schedule the number of Tasks needed to reach |
Adds support for ReplicatedJob and GlobalJob service modes. These modes allow running service which execute tasks that exit upon success, instead of daemon-type tasks. Signed-off-by: Drew Erny <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Nicely done!
Would love to blog around this. Which Docker release is it coming with? Beta bits? |
CLI PR is open, pending the merge of this PR. |
Amazing. Thank you for the work! When is this planned to be released? |
👏 👏 💯 |
Very nice, thanks for this! I'll soon be able to archive swarm-cronjob 😅 |
@dperny Thanks for this new feature 👏 |
@dperny you're a blessing to open source. thank you. |
This is really good stuff! Question: Would it be possible to specify jobs via compose/stack file too? or this will only work via CLI? Edit: Moving the question to docker/cli#2262 which is where it was being discussed. |
Nice work! I would have loved this three years ago 😄 I've actually seen a rise in interest in alexellis/jaas so I think this will be well received by the community of users still on Swarm. |
Is it possible to create cron job with swarm? |
proposal (in swarmkit): moby/swarmkit#2852
- What I did
Adds support for Jobs in Swarm Mode
Jobs are Services which run some number of Tasks to completion (the container exiting with code 0) and then stop executing new Tasks.
- How I did it
ReplicatedJob
andGlobalJob
.ReplicatedJob
has two fields:MaxConcurrent
, which sets the maximum number of tasks to run at the same time for the job, andTotalCompletions
, which is the number ofCompleted
tasks desired for the job. IfMaxConcurrent
is not set, it will default to1
. IfTotalCompletions
is not set, it will default to the value ofMaxConcurrent
GlobalJob
has no fields. Like a global service, global jobs are scheduled on every node in the cluster matching placement constraints.Service
object, present when the Service is a job:JobStatus
, which includes a counter for running the same job multiple times.Task
object, present when it belongs to a job:JobIteration
, which is identical to the value ofJobStatus.JobIteration
on the Service that spawned this Taskswagger.yml
with documentation for all new fields.version-history.md
to include information about new jobs fields.- How to verify it
Includes new integration tests for jobs functionality.
- Description for the changelog
Swarm Mode now supports running Jobs.