Commit d30bdbda authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

task_utils: create a simple decorator to spawn a task

parent c81a18f8
......@@ -162,3 +162,15 @@ def task(func):
return start_task
def simple_task(func):
def start_task(*args, **kwargs):
wait = kwargs.pop("wait", True)
timeout = kwargs.pop("timeout", None)
t = gevent.spawn(func, *args, **kwargs)
if wait:
return t.get(timeout = timeout)
return t
return start_task
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment