Exemple #1
0
 def replace_func_flow(a, b):
     first_job = simple_job(str(a + b))
     second_job = simple_job(first_job.output)
     flow = Flow(
         [first_job, second_job],
         {
             "first": first_job.output,
             "second": second_job.output
         },
     )
     return Response(output=a + b, replace=flow)
def fibonacci(smaller, larger, stop_point=1000):
    """Calculate the next number in the Fibonacci sequence.

    If the number is larger than stop_point, the job will stop the workflow
    execution, otherwise, a new job will be submitted to calculate the next number.
    """
    total = smaller + larger

    if total > stop_point:
        return total

    new_job = fibonacci(larger, total, stop_point=stop_point)
    return Response(output=total, addition=new_job)
Exemple #3
0
 def detour_func(a, b):
     return Response(output=a + b, detour=simple_job(str(a + b)))
Exemple #4
0
 def addition_func(a, b):
     return Response(output=a + b, addition=simple_job(str(a + b)))
Exemple #5
0
 def replace_and_detour_func(a, b):
     return Response(output=a + b,
                     replace=simple_job(str(a + b)),
                     detour=simple_job("xyz"))
Exemple #6
0
 def detour_stop_func(a, b):
     return Response(output=a + b, detour=stop_jobflow_job())
Exemple #7
0
 def stored_data_func(message):
     return Response(output=message + "_end", stored_data={"a": "message"})
Exemple #8
0
 def stop_children_func():
     return Response(output="1234", stop_children=True)
Exemple #9
0
 def stop_jobflow_func():
     return Response(output="1234", stop_jobflow=True)
Exemple #10
0
 def replace_func(a, b):
     return Response(output=a + b, replace=simple_job(str(a + b)))