Skip to content

Feature request: automatic .output resolving in flow-decorated functions #884

Description

@Andrew-S-Rosen

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions