How to use the circus.get_arbiter function in circus

To help you get started, we’ve selected a few circus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wapiflapi / binglide / binglide / server / __init__.py View on Github external
def run(config):

    arbiter = circus.get_arbiter(config['server'])

    try:
        arbiter.start()
    finally:
        arbiter.stop()
github onitu / onitu / onitu / __main__.py View on Github external
if not session:
        logger.error("Your setup must have a name.")
        return 1

    logs_uri = get_logs_uri(session)
    if not args.no_dispatcher:
        dispatcher = get_logs_dispatcher(
            config_dir, logs_uri, debug=args.debug
        )
    else:
        dispatcher = None

    with ZeroMQHandler(logs_uri, multi=True):
        try:
            arbiter = circus.get_arbiter(
                (
                    {
                        'name': 'Escalator',
                        'cmd': sys.executable,
                        'args': (
                            '-m', 'onitu.escalator.server', session, config_dir
                        ),
                        'copy_env': True,
                        'graceful_timeout': GRACEFUL_TIMEOUT
                    },
                ),
                proc_name="Onitu",
                controller=get_circusctl_endpoint(session),
                pubsub_endpoint=get_pubsub_endpoint(session),
                stats_endpoint=get_stats_endpoint(session),
                loglevel='WARNING',
github mozilla-services / powerhose / powerhose / __init__.py View on Github external
'executable': python,
                 'stderr_stream': stream,
                 'stdout_stream': stream
                 },
                {'name': 'workers',
                 'cmd': ' '.join(worker_cmd),
                 'numprocesses': numprocesses,
                 'working_dir': working_dir,
                 'executable': python,
                 'stderr_stream': stream,
                 'stdout_stream': stream
                 }
                ]

    # XXX add more options
    arbiter = get_arbiter(watchers, background=background)

    # give a chance to all processes to start
    # XXX this should be in Circus
    if background:
        start = time.clock()
        while time.clock() - start < 5:
            statuses = [status == 'active' for status in
                        arbiter.statuses().values()]
            if all(statuses):
                break

    return arbiter
github circus-tent / circus / examples / apis.py View on Github external
from circus import get_arbiter

myprogram = {"cmd": "sleep 30", "numprocesses": 4}

print('Runnning...')
arbiter = get_arbiter([myprogram])
try:
    arbiter.start()
finally:
    arbiter.stop()
github philipcristiano / fairground / fairground / arbiter_manager.py View on Github external
def __init__(self, *args, **kwargs):
        self._arbiter = get_arbiter([], *args, background=True, **kwargs)
        self._arbiter.start()
        self._client = create_circus_client()
github philipcristiano / fairground / fairground / arbiter_manager.py View on Github external
def __init__(self):
        self._arbiter = get_arbiter([], background=True)
        self._arbiter.start()
        self._client = create_circus_client()
github mozilla-services / powerhose / powerhose / client / workers.py View on Github external
def __init__(self, cmd, num_workers=5, timeout=1.,
                 check=5., controller='tcp://127.0.0.1:5555', **kw):
        self.arbiter = get_arbiter(cmd, num_workers, timeout,
                                   controller=controller,
                                   check_flapping=True, **kw)