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

Docs: Task Dependency Example in Tutorial Not Working as Described #195

Open
taylor-curran opened this issue Jun 30, 2024 · 1 comment
Open

Comments

@taylor-curran
Copy link

The task dependency example in the ControlFlow documentation under the "Hello, tasks" section isn't functioning as expected. Here are the issues:

When Running the Example Code as Provided:

import controlflow as cf
from pydantic import BaseModel

class Name(BaseModel):
    first: str
    last: str

name = cf.Task("Get the user's name", user_access=True, result_type=Name)
poem = cf.Task("Write a personalized poem", context=dict(name=name))

poem.run()

Outcome : The process hangs indefinitely, requiring a manual interrupt.

When Running the Tasks Explicitly in Sequence:

I'm not sure if this is the correct way to run these outside of a flow...

name.run()
poem.run()

Outcome : The name task runs successfully, but the poem task throws an error:

RuntimeError: dictionary changed size during iteration

This contradicts the docs, which state:

"ControlFlow will automatically run any dependencies before executing the task you requested. In the above example, we only ran the poem task, but ControlFlow automatically ran the name task first, then passed its result to the poem task's context. We can see that both tasks were successfully completed and have result values."

Environment:

  • ControlFlow version : 0.8.1

  • Python version : 3.12.2

  • Prefect version : 3.0.0rc9

@jlowin
Copy link
Member

jlowin commented Jul 3, 2024

I think this is the same issue as #198, which I haven't been able to replicate but I'm hoping the new backend removes.

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

No branches or pull requests

2 participants