Florian Kühnlenz
04/06/2021, 3:00 PMprefect register --module
work.
My project looks like this:
flows
+ __init__.py
+ my_flow.py
+ shared_tasks
+ __init__.py
+ util.py
When I run prefect register --project 'Prefect Testing' -m '<http://flows.my|flows.my>_flow'
, I get No module named 'flows'
. What am I missing?Kevin Kho
flows
or flow
?Florian Kühnlenz
04/06/2021, 3:07 PMflows
, but sadly the typo was only in slack 😞. I can also import the module just fine in python.Florian Kühnlenz
04/06/2021, 3:11 PMpython -c "import flows; <http://flows.my|flows.my>_flow.test_flow.register('Prefect Testing')"
it works just fine.Kevin Kho
Kevin Kho
___init___.py
?Florian Kühnlenz
04/06/2021, 4:35 PMFlorian Kühnlenz
04/06/2021, 4:37 PMKevin Kho
Kevin Kho
setup.py
and you need to install the library pip install -e .
. This will allow it to find the module. prefect register --module my_package.flows --project example
worked for me (although the flows are useless)Kevin Kho
Florian Kühnlenz
04/06/2021, 7:11 PMprefect register
would need the module installed via pip while the normal flow.register
method would not. Is this mentioned somewhere in the documentation?Kevin Kho
flow.register
with the Module
storage? This is not documented. I’m considering adding itFlorian Kühnlenz
04/06/2021, 7:25 PMKevin Kho
Kevin Kho
flow.storage = Docker(
files={"path/to/my_module": "my_module"},
extra_dockerfile_commands=["RUN pip install -e my_module}"],
)
Florian Kühnlenz
04/06/2021, 7:45 PMif __name__ == “__main__”:
flow.register()
At the bottom of each flow. Which one would need to change for debugging.
With the new cli I did not manage to make it work, maybe because there is a fix upstream about the python context (https://github.com/PrefectHQ/prefect/pull/4332)Kevin Kho
Kevin Kho
from my_package.flow1 import flow
; flow.run()
. Not definitively saying this is how to do things. Just throwing options out there, but I’ll add the documentation addition to my list 🙂