-
Notifications
You must be signed in to change notification settings - Fork 158
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
Scheduled tasks #919
Scheduled tasks #919
Conversation
"github.com/remind101/empire/scheduler" | ||
) | ||
|
||
var ( |
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.
As part of this, I ended up cleaning up some of the template building by replicating some of troposphere in Go. If it gets cumbersome to review, I can pull that out into a separate PR and rebase this.
And, to explain the implementation a little more, it's actually pretty simple: For processes that have a
So, it's just CloudWatch Events -> Lambda -> ECS task. |
return containerDefinition | ||
} | ||
|
||
func serviceAssumeRolePolicy(service string) interface{} { |
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.
Remove this
7b1c9f1
to
9a66383
Compare
👍 So cool. |
https://github.com/remind101/empire/wiki/Roadmap#scheduled-tasks
Closes #300.
This adds first class support for scheduled tasks. It uses a combination of CloudWatch events, lambda, and ECS to run scheduled jobs in separate containers.
Lots of advantages to this, over doing some kind of in process cron:
Memory/CPU constraints can be controlled for each scheduled task, since the jobs run in a short lived ecs tasks.
emp restarts
won't affect the scheduled tasks. Scheduled tasks that are already running will continue to run.Scheduled tasks will show up in
emp ps
:Scheduled tasks are configured in the Procfile, using the new extended Procfile format. To mark a process as a scheduled job, you add a
cron:
field to the process, with a cron expression for when it should run:By default, scheduled processes are disabled by default (like other processes), and need to be scaled up to run:
$ emp scale scheduled-job=1
You can scale past 1 to run multiple tasks at once when the cron event triggers:
And you can scale back down to 0 to disable the scheduled process:
$ emp scale scheduled-job=0
TODO