question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal PIN: Remove ConstantTasks

See original GitHub issue

Store Constant Values on Flow

Status

Proposed

Context

When a dependency is created between a task and any non-task value, Prefect automatically wraps the upstream value in a ConstantTask and creates an appropriate edge. This “works” in the sense that it properly models a relationship between a computational node (the constant value) and a task that consumes it; but it adds noise to flow graphs that is confusing to users that don’t expect it. Furthermore, it adds edge-case potential for error in some circumstance where the constant task fails (for any reason including a node crashing) and results in a difficult-to-diagnose flow failure. In addition, it creates difficulties with triggers, as the ConstantTask always succeeds.

Simply put: ConstantTasks are confusing and do not add information.

Proposal

ConstantTasks will no longer be automatically created (though they can stay in the task library, as they may be useful for particularly large objects that users only want to reference once in their flow).

Instead, if a task is attached to any constant (non-Task) value, that value is added to a new flow attribute, flow.constant_values. This attribute is a dictionary Dict[Task, Dict[str, Any]] that maps each task to a collection of input argument values. For example, if task t is called in the functional API as t(x=1), then flow.constants[t] would be updated to {t: {x: 1}}. An additional “validation” step would ensure that the keys of flow.constants were always a strict subset of flow.tasks.

In addition, the TaskRunner.run() method will accept a constant_inputs kwarg and FlowRunner.run() will read and provide the appropriate values for each task. The TaskRunner is responsible for combining those with the upstream state values in order to provide all input arguments for the task itself.

Consequences

ConstantTasks will no longer be created (though they can remain in existence in case users find them useful for encapsulating some piece of information). Constants that are used in a flow will be stored in a nested dictionary attached to the flow itself.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jlowincommented, Mar 20, 2019

Expect, no.

Anticipate, maybe.

We’ve very successfully adhered to the “flowless task” model thus far and I don’t want to abandon it quite yet!

0reactions
jlowincommented, Mar 31, 2019

I’ve updated the PIN proposal to incorporate this discussion

Read more comments on GitHub >

github_iconTop Results From Across the Web

PIN-6: Remove Constant Tasks - Prefect Docs
Proposal. Constant tasks will no longer be automatically created (though they can stay in the task library, as they may be useful for ......
Read more >
Assign a PIN to a Proposal
In the Temporary Proposals in Progress list (Figure 1), highlight the proposal that you want to assign a PIN to. 3. Click the...
Read more >
Remove-CsPinPolicy (SkypeForBusiness) - Microsoft Learn
The Remove-CsPinPolicy cmdlet enables you to remove PIN policies that have been configured at either the site scope or the per-user scope. When...
Read more >
Proposal: remove pinned repo list on GitHub
GitHub has a limit of six pinned repos. When we added these pins, we didn't have six top level projects. Now we have...
Read more >
Edit proposed changes - Google Ads Editor Help
Is the proposal editable? Result of editing. Edit existing item, yes, Your change is applied, and the proposed change is cleared. Edit removed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found