#6024 [flytekit] Update calling task in task behavior
Issue created by
wild-endeavor on <!date^1731949096^{date_short}|2024-11-18T16:58:16Z>
### User Code
If you have something like this
from flytekit import task, workflow
@task
def outer():
inner()
print("outer")
@task
def inner():
print("inner")
@workflow
def wf():
outer()
### Current Behavior
It works in recent versions of flytekit.
### Goal: What should the final outcome look like, ideally?
This pattern should not work without an active decision from the user. We want to actively discourage accidentally doing this for a variety of reasons. One is that the behavior is different from when calling a task within a wf - all the procedures and logic behind a normal task run applies. When you call a task within a task, the idea is that it's executing as if flyte doesn't exist - you're just invoking the underlying function.
Proposal from
@cosmicBboy
• when calling a task within a task, raise a deprecation warning saying “this will run as a local function within the parent task, saying this will raise an error in flytekit version X.Y.Z, use
<task>. python_function()
explicitly to call as a local function”.
• when we release version X.Y.Z raise an error, add migration guide to the release notes / blogs for that release.
We should probably give this at least a few months, maybe half a year, before making it an error.
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flyte