Rui Rego

02/02/2021, 8:10 PM
Hi. I'm new to prefect (and docker by the way). I'm able to start prefect server via terminal inside Pycharm. I'm starting a local agent from a terminal in Pycharm also. Then I'm registering a flow. I open the UI and the flow is correctly registered and scheduled. I'm letting the flow run for a few times and it executes successfully. Then I close Pycharm and that terminates the terminals where I have started prefect server and the agent. If I'm understanding it well, prefect server is still running on a docker container (I can see that via Docker Desktop) but I need to start a new agent. So I run a python script to start the agent and it is successful:
from prefect.agent.local import LocalAgent
After that, all scheduled executions of the flow are failing with:
Failed to load and execute Flow's environment: StorageError('An error occurred while unpickling the flow:\n ModuleNotFoundError("No module named \'src\'")\nThis may be due to a missing Python module in your current environment. Please ensure you have all required flow dependencies installed.')
What am I doing wrong? I am using Windows 10, python 3.9 and a virtual environment (venv).
Well. instead of using LocalAgent().start() in a python script, I used the following instruction in the venv via windows cmd: prefect agent local start. Everything started working bur now I have a CMD window that I can´t close...