tasks.py 1.05 KB
Newer Older
Janez K's avatar
Janez K committed
1
from celery.task import task
2 3 4 5 6 7 8 9
import workflows.library

@task()
def add(a,b):
    import time
    time.sleep(10)
    raise Exception("test")
    return a+b
Janez K's avatar
Janez K committed
10 11 12 13 14

@task()
def runForLoopIteration(workflow,iteration):
    pass

15 16 17 18
@task()
def executeWidgetFunction(widget,input_dict):
    function_to_call = getattr(workflows.library,widget.abstract_widget.action)
    return function_to_call(input_dict)
Janez K's avatar
Janez K committed
19 20

@task()
21 22 23
def executeWidgetProgressBar(widget,input_dict):
    function_to_call = getattr(workflows.library,widget.abstract_widget.action)
    return function_to_call(input_dict,widget)
Janez K's avatar
Janez K committed
24 25

@task()
26 27 28 29 30 31 32 33 34 35 36 37
def executeWidgetStreaming(widget,input_dict):
    function_to_call = getattr(workflows.library,widget.abstract_widget.action)
    return function_to_call(input_dict,widget,None)

@task()
def executeWidgetWithRequest(widget,input_dict,output_dict,request):
    function_to_call = getattr(workflows.library,widget.abstract_widget.action)
    return function_to_call(request,input_dict,output_dict)

@task()
def runWidgetAsync(widget):
    widget.run(True)