Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy task inputs to protect against modifications before execution time #137

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nicolasmueller
Copy link
Contributor

Currently task inputs may me modified after the task has been declared. This leads to the unintuitive situation that a task may receive different arguments at runtime than at declaration time. In particular constructions like

a = inputs()
tables: dict[str, Table] = {"dfA": a}
a2 = double_a(tables)
tables["dfA2"] = a2
halfen_tables(tables)

crash at flow runtime, because double_a at runtime depends on the last version of tables which contains "dfA2" already.

Note that a fix for this breaks test_change_bound_argument.

Is the current behavior intended?

Checklist

  • Added a docs/source/changelog.md entry

@NMAC427
Copy link
Member

NMAC427 commented Feb 20, 2024

I think I might have written the test_change_bound_argument test case without properly thinking about what the actual intended behaviour should be. I agree that modifying the arguments after binding them to a task shouldn't have an influence on the task outcome. While I initially had some concerns about the use of deepcopy, I think that it shouldn't lead to any issues, because tasks only support a limited set of input types.

@NicolasMuellerQC
Copy link
Contributor

@NicholasHoernleQC what's your opinion on this :) , i.e. should we copy and freeze task inputs at declare time?

@nicolasmueller nicolasmueller self-assigned this Feb 24, 2024
@windiana42
Copy link
Member

I think we can go for the "safe" solution to deep_copy the inputs even though I recommend noone to write code where this matters. Performance slowdown should be negligible compared with what computations we expect to be performed in pipedag.
Thus modifying the test is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants