Willian Chan
04/05/2021, 9:59 PMGitLab
The UI tells me: Failed to load and execute Flow's environment: ModuleNotFoundError("No module named 'mail_client'")
.
The main problem here is that the file mail_client.py is not present in the agent, and for me it is impracticable to send each auxiliary script to the agent (there is going to be a lot of flows)
The structure of the repository:
gitlab-repository/
├── flow.py
└── mail_client.py
Inside my flow.py it imports the mail_client:
from mail_client import MailClient
...
...
The configuration for GitLab
storage:
flow.storage = GitLab(
repo="XXXXX",
host="XXXXX",
path="flow.py",
secrets=["GITLAB_ACCESS_TOKEN"]
)
I need the agent to be able to pull the entire repository because there will be many processes being inserted in the prefect and there is no way to change the agent with each modification in a process.
does anyone have any solution for this? ThanksKevin Kho
Docker
. This documentation may help: https://docs.prefect.io/orchestration/recipes/configuring_storage.html#including-other-python-scriptsKevin Kho
Willian Chan
04/05/2021, 10:16 PMWillian Chan
04/05/2021, 10:23 PMKevin Kho
Kevin Kho
pip install -e .
and then pull from your repo every time you make a change. Not best practice but this might work.Willian Chan
04/05/2021, 10:32 PMKevin Kho
Kevin Kho
Willian Chan
04/05/2021, 10:44 PMKevin Kho
Willian Chan
04/05/2021, 10:54 PMKevin Kho
git pull work_repo, pip install xxx
. And then your flow script would use it like from work_repo import func1
. Prefect just knows a file exists and will try to run it. This normally does not work because the agent doesn’t have dependencies, but if you install the dependencies, you can get it to workKevin Kho
Willian Chan
04/05/2021, 11:17 PMKevin Kho