Created
April 11, 2017 23:07
-
-
Save asterite3/4e5a2bafdfbea504454b2c1388e93559 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import circus | |
from circus import get_arbiter | |
from tornado import gen | |
task = { | |
"cmd": "ls", | |
"args": ["/tmp/test-mount/"] | |
} | |
arbiter = get_arbiter(watchers=[task], debug=True) | |
@gen.coroutine | |
def stop_arbiter_after_timeout(): | |
print 'sleeping' | |
yield gen.sleep(5) | |
print 'stopping arbiter' | |
yield arbiter.stop() | |
print 'stopped' | |
def start_arbiter(*args, **kwargs): | |
print 'start arbiter' | |
arbiter.start(cb=kwargs['callback']) | |
@gen.coroutine | |
def run(): | |
yield [stop_arbiter_after_timeout(), gen.Task(start_arbiter)] | |
run() | |
print 'done' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment