Slackbot
12/02/2024, 6:00 PMMarvin
12/02/2024, 6:00 PMPrefect isn't detecting task dependencies when I invoke a function manually and use those results in the next task. However, the documentation claims that this would happen automatically. (I can't imagine how that would work, but I was hoping to be pleasantly surprised). The documentation: https://orion-docs.prefect.io/latest/guides/specifying-upstream-dependencies/
Automatic¶
When a result from a task is used as input for another task, Prefect automatically recognizes the task that result originated from as an upstream dependency.
This applies to every way you can run tasks with Prefect, whether you're calling the task function directly, callingThis other page says that it's a good idea to use either all task invocations (via calls to submit) or all python invocations (calling the method directly) https://orion-docs.prefect.io/latest/concepts/task-runners/?h=submit#using-results-from-submitted-tasks It only warns about task dependency checking in the "mixed use" case: For instance: ``` @task def get_random_number() -> int: return random.randint(0, 100) @task def print_random_number(random_number: int): print(f"The, or calling.submit()
. Subflows similarly recognize tasks results as upstream dependencies..map()
Marvin
12/02/2024, 6:01 PMPrefect isn't detecting task dependencies when I invoke a function manually and use those results in the next task. However, the documentation claims that this would happen automatically. (I can't imagine how that would work, but I was hoping to be pleasantly surprised). The documentation: https://orion-docs.prefect.io/latest/guides/specifying-upstream-dependencies/
Automatic¶
When a result from a task is used as input for another task, Prefect automatically recognizes the task that result originated from as an upstream dependency.
This applies to every way you can run tasks with Prefect, whether you're calling the task function directly, callingThis page says it's a good idea to use either all task invocations or all python invocations (calling the method directly) https://orion-docs.prefect.io/latest/concepts/task-runners/?h=submit#using-results-from-submitted-tasks ```@task(log_prints=True) def get_random_number() -> int: return random.randint(0, 100) @task(log_prints=True) def print_random_number(random_number: int) -> None: print(f"The random number is: {random_number}") @flow(log_prints=True) def random_number_flow():, or calling.submit()
. Subflows similarly recognize tasks results as upstream dependencies..map()