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

Added decorator pattern and unit tests for add_task. #5

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

Conversation

iodone
Copy link

@iodone iodone commented Dec 10, 2024

We can add tasks like this:

    @flow.task("decorated_task")
    def action(ctx) -> TaskOutput:
        return TaskOutput("result")

    result = flow.run("decorated_task")

@skull8888888 Do you think this approach is feasible?

@skull8888888
Copy link
Contributor

@iodone decorator is a good suggestion, although I am a bit worried that it might cause confusion on what to use, add_task or @flow.task? I'm not sure tho, what are your thoughts?

Initial reason for .add_task was to be able to import function from another files.

@iodone
Copy link
Author

iodone commented Dec 17, 2024

@iodone decorator is a good suggestion, although I am a bit worried that it might cause confusion on what to use, add_task or @flow.task? I'm not sure tho, what are your thoughts?
Initial reason for.add_task was to be able to import function from another files.

IMO, both can be supported. The decorator pattern is mainly to use a declarative way to plan the entire flow at once, which is user-friendly.

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.

2 participants