Alejandro Sanchez Losa

    Alejandro Sanchez Losa

    9 months ago
    Hi every body !!! Is there any way to separete @task in diferent files using github storage? when I try that (new folder, import this file with def with @task decoraction and import of the prefect task …) the output tall me: ModuleNotFoundError: No module named ‘tasks’
    Anna Geller

    Anna Geller

    9 months ago
    what agent do you use? the easiest would be if you install your custom code as a package into your execution environment, then you will be able to import it.
    this repo contains an example with a demo package called “flow_utilities” - you would need to package your tasks into your package
    Alejandro Sanchez Losa

    Alejandro Sanchez Losa

    9 months ago
    I setup UniversaRun because I have Local and Docker agents
    so is best practice build a package to disengage the tasks ?
    when you import the flow_utilities … the functions don’t need @task ?
    Anna Geller

    Anna Geller

    9 months ago
    it depends on whether you add the task decorator in your packaged function, or whether you just import and call it within a task
    Alejandro Sanchez Losa

    Alejandro Sanchez Losa

    9 months ago
    hummm ok … thanks so much 🙂
    I am trying …
    I am traying to build module but … dont works … I don know what I am missing …
    Anna Geller

    Anna Geller

    9 months ago
    looks like you import the module named “components” but it’s not within your package. Can you check if your imports are specified correctly or if you packaged this module properly?
    Alejandro Sanchez Losa

    Alejandro Sanchez Losa

    9 months ago
    I think maybe will be because the STORAGE just identify main.py ? and components are module in other folder
    What I am trying to do are put the tasks individually in separate files becase each task are a little bit complicate After that build a flow that can call this tasks Using github actions and store … and I have the feel maybe that is not posible
    Anna Geller

    Anna Geller

    9 months ago
    you can definitely design your flow in such a way that your task’s business logic is defined in some other module rather than directly in the flow. It’s all a matter of packaging it into a python package or a Docker container. Not sure why building a package doesn’t work for you. Perhaps Docker storage will be easier?