The following does not work because a * b cannot be done, as sum_result is a Job and not the resolved output. It would be nice to be able to construct flows without having to explicitly call .output. We can already return Job objects and get the .output automatically resolved, which is why the second example works, but the first example would be ideal to get working too.
This fails:
from jobflow import job, flow, run_locally
@job
def add(a, b):
return a + b
@job
def mult(a, b):
return a * b
@flow
def workflow(a, b):
sum_result = add(a, b)
mult_result = mult(a, sum_result)
return mult_result
output = run_locally(workflow(1, 2))
This works:
@job
def add(a, b):
return a + b
@job
def mult(a, b):
return a * b
@flow
def workflow(a, b):
sum_result = add(a, b)
mult_result = mult(a, b)
return mult_result, sum_result
output = run_locally(workflow(1, 2))
The following does not work because
a * bcannot be done, assum_resultis aJoband not the resolved output. It would be nice to be able to construct flows without having to explicitly call.output. We can already returnJobobjects and get the.outputautomatically resolved, which is why the second example works, but the first example would be ideal to get working too.This fails:
This works: