Miguel Angel
08/02/2021, 6:23 PM.my-package
├── __init__.py
├── _config.yml
├── flows
├── __init__.py
├── flow1.py
├── flow2.py
└── flow3.py
└── utils.py
So I can expose my flows via storage object like this:
from prefect.storage import Module
storage = Module("my-package.flows")
Each of the flows that belong to my-package
have the following structure:
from prefect import Parameter, task
from prefect.utilities import logging as logging
def core_function(**args)-> prefect.flow:
# process flow
return flow
flow = core_function()
Seem legit to me, since I haven't spotted any downside, do you have any recommended pattern or advise?Kevin Kho
Miguel Angel
08/02/2021, 6:44 PMFailed to load and execute Flow's environment: ValueError("Failed to find flow 'flow1' in 'my-package.flows'")
So, what I'm trying to do is import them right away on my flows.___init__.py_
so can be instantiated on creation.Kevin Kho
Kevin Kho
Miguel Angel
08/02/2021, 7:38 PMKevin Kho
setup.py
to actually package the Python directory into a module. I have an example up there. You need it to install the module with pip
Miguel Angel
08/02/2021, 7:41 PMMiguel Angel
08/02/2021, 7:46 PMpython -c "from my-package.flows import flow1, flow2, flow3"
SuccessfullyKevin Kho
DockerRun
and the Docker
agent so that when it pulls the Flow, it will run it on top of that image.Miguel Angel
08/02/2021, 7:59 PMmy-package
container, Once it's deployed I could get further logs, but keeps pointing out to
Failed to load and execute Flow's environment: ValueError("Failed to find flow 'flow1' in 'my-package.flows'")
Kevin Kho
Miguel Angel
08/03/2021, 10:43 AMMiguel Angel
08/03/2021, 1:41 PMflow.storage = Module("my-package.flows.<flow_name>")
Miguel Angel
08/03/2021, 1:48 PMpyproject.toml
file instead the refereed setup,pyKevin Kho
Miguel Angel
08/03/2021, 4:38 PM