Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(config):
arbiter = circus.get_arbiter(config['server'])
try:
arbiter.start()
finally:
arbiter.stop()
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',
'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
from circus import get_arbiter
myprogram = {"cmd": "sleep 30", "numprocesses": 4}
print('Runnning...')
arbiter = get_arbiter([myprogram])
try:
arbiter.start()
finally:
arbiter.stop()
def __init__(self, *args, **kwargs):
self._arbiter = get_arbiter([], *args, background=True, **kwargs)
self._arbiter.start()
self._client = create_circus_client()
def __init__(self):
self._arbiter = get_arbiter([], background=True)
self._arbiter.start()
self._client = create_circus_client()
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)