Skip to main content

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)

Uploaded Source

Built Distribution

swarm_regulator-0.1.1-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page