dowding
Docker cluster scheduler
The name is a tribute to the real master planner
install
$ npm install dowding
usage
var dowding = var scheduler =
To allocate a new container:
scheduler
Allocate a server that does not run another 'myjob' container (mutual exclusion):
scheduler
Allocate the server that is running the basevolume
container:
scheduler
mutual exclusion
If a container has a name of the following format:
<jobname>.<pid>
For example:
auth.abc
and
auth.xyz
These 2 auth containers will not be allocated onto the same server.
Here is an example of running the allocation:
scheduler
If you just want a server you can omit the filter information:
scheduler
parent
You can instruct dowding to allocate a container onto a server that another container is running.
This is useful in scenarios like --volumes-from
where one container has a local dependency on another.
least-busy
When there are multiple servers that could be choosen - the default behaviour is to pick the least busy
server.
Least busy is determined by the number of containers running on each host.
You can pass a function to override this decision.
The function will be passed an object where the keys are the server hostname and the values are objects with the following properties:
- hostname
- docker
- jobs
You can use this information to decide which server should be allocated.
api
var scheduler = dowding(opts)
Create a new scheduler passing the following options:
- inventory - a function that will return a list of servers on our network
- leastBusy - a function that defines the logic for picking the least busy of our servers
scheduler.allocate([opts], function(err, server){})
Allocate a docker server for a job
Opts is an optional object used to filter the allocation - it has these keys:
- name - the name of the container, possibly in . format for mutual exclusion
- parent - the name of a parent container - the job will be routed to the server it is running on
scheduler.find(name, function(err, server){})
Find which server that a container is running - server can be null if the container is not found.
license
MIT