The regulator of your Docker Swarm cluster
Project description
Swarm Regulator
Regulate your Docker Swarm cluster, with YOUR rules.
TBD
Requirements
- Docker Swarm Mode cluster
Install
TBD
Run
TBD
Example
regulator.py
from swarm_regulator import consumer
def _extract_constraints(service_spec):
return service_spec["TaskTemplate"]["Placement"].get("Constraints", [])
def has_not_constraints(service_spec) -> bool:
constraints = _extract_constraints(service_spec)
return not len(constraints)
async def do_not_schedule_on_gpu(service_spec):
constraints = _extract_constraints(service_spec) + ["node.labels.gpu!=true"]
service_spec["TaskTemplate"]["Placement"]["Constraints"] = constraints
return service_spec
consumer.register_rule(
"service", has_not_constraints, do_not_schedule_on_gpu,
)
consumer.run()
Run
python regulator.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
swarm-regulator-0.1.1.tar.gz
(4.3 kB
view hashes)
Built Distribution
Close
Hashes for swarm_regulator-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f3dbdb1825734d938313aa9e1fc81b42e24ba6b133cdf408ad77f37c1feb55d |
|
MD5 | 8849538463653e4d9be46e7c892a3c67 |
|
BLAKE2b-256 | 7c3d1ac00aee0dd7258d607dbbd6a1937542863712afce436745a335e738940d |