Skip to content

De-dupe constant tasks #1527

Closed
Closed
@bnaul

Description

Probably not a high priority (and maybe not feasible for some reason I haven't thought of) but I find this behavior a bit irritating:

from prefect import task, Flow
from prefect.engine.executors import DaskExecutor

@task
def add(x, y):
    return x + y

with Flow('flow') as flow:
    for i in range(10):
        add(i, 0)

flow.run(executor=DaskExecutor('localhost:8786'))

Result: the constant 0 task is repeated every time, as is the corresponding log:
Screen Shot 2019-09-17 at 9 38 29 PM

[2019-09-18 04:37:19,486] INFO - prefect.TaskRunner | Task '0': Starting task run...
[2019-09-18 04:37:19,486] INFO - prefect.TaskRunner | Task '0': Starting task run...
[2019-09-18 04:37:19,489] INFO - prefect.TaskRunner | Task '0': Starting task run...
[2019-09-18 04:37:19,492] INFO - prefect.TaskRunner | Task '0': finished task run for task with final state: 'Success'
[2019-09-18 04:37:19,493] INFO - prefect.TaskRunner | Task '0': finished task run for task with final state: 'Success'
[2019-09-18 04:37:19,497] INFO - prefect.TaskRunner | Task '0': finished task run for task with final state: 'Success'
...

Is there any kind of simple de-duping scheme that might work within a flow, maybe just for Python literals...?

Edit: possibly kind of a dupe of #891 which was already declined...? 🤷‍♂

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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