Is there a clean way to handle task result?

I’m finding myself creating a lot of tasks to do simple manipulation on my task results (usually parameters) prior to passing it to another task, like path joins. It feels like I’m creating tasks that are just one line wrappers around python functions. Is there a better way to do this, or is that the expected workflow?

1 Like

This is not expected since in Prefect 2.0, you can write arbitrary Python code in your flows! You have full control over how you design your tasks and flow. Could you share some example code showing what you have so far and what you are trying to accomplish?

My mistake, I clicked the wrong tag! I’m using prefect 1.2, not 2.0

An example of what I’m trying to do here is

with Flow("example_flow",) as flow:
    folder_param = Parameter("folder")

    working_folder = os.path.join(folder_param)


Gotcha. In Prefect 1.0, unfortunately, you would need to move this part into a separate task. It won’t work reliably otherwise:

def get_path(folder_param):
    return os.path.join(folder_param)

Perhaps this can get you a little bit more excited to slowly migrate to Prefect 2.0 :smile: You can already do that! Check this post for more details:

And this Discourse tag for various migration examples: Topics tagged migration-guide