Elliot Oram

01/07/2022, 12:21 PM
Hi all, I am trying to setup a system where I can have prefect agents on different machines from the prefect server. Right now I have a prefect server on machine A and prefect agent on machine B. I can register the agent and it shows up in the UI no problem. When it comes to running flows however, there is no issue. Before any of the tasks start to execute I get the error in the screenshot:
Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/home/ubuntu/'")
The agent is running in a python virtual environment (I have also tried this without the venv and the result is the same) the agent is started with the following command:
prefect agent local start --api <>
Any ideas on what might be the cause, or how to start debugging this?

Anna Geller

01/07/2022, 12:31 PM
It seems that the problem here is the flow storage. You registered the flow with local agent and local storage on one machine, but this flow doesn’t exist on a different machine. When prefect runs your flow, it tries to pull your flow from a local storage file which doesn’t exist on the agent. The easiest way to solve it would be to leverage a separate system for storage, e.g. GitHub storage or S3 and store the flow as script. Alternatively, you can try registering your flow from the agent machine, but this would be more cumbersome.
if you need more examples of storage - run configuration, check out this repo

Elliot Oram

01/07/2022, 4:04 PM
Hi @Anna Geller ah this sounds like a flaw in my understanding of prefect! It's my first time working over multiple machines and hadn't come across differing storage configurations. Thanks very much, changing to a git storage solution worked 👍
🙌 1