Howdy folks - anyone hit this one before? ```[21 ...
# ask-community
j
Howdy folks - anyone hit this one before?
Copy code
[21 June 2021 1:41pm]: Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/root/'")
k
Hey @Joe, what RunConfig and Agent are you using?
j
Here's what I have, hopefully this will answer your questions: • Server is running in Docker on an EC2 • I connected an agent from my workstation with prefect agent local start --api [redactedhostandport] --no-hostname-label -l JoeTestAgent
k
Are you using any Storage for the flow?
j
The code for the job looks like:
import prefect
from prefect import task, Flow from prefect.run_configs import DockerRun @task def say_hello(): logger = prefect.context.get("logger") logger.info("Hello, cloud!") with Flow("hello-flow") as flow: say_hello() flow.run_config = DockerRun() flow.register(project_name = "joe test", labels = ["JoeTestAgent"])
Not that I'm aware of - do I need to set up some sort of storage to run a Hello World?
k
Got it. So what's happening when you register your flow is that it's serialized and stored in
Storage
. If you don't specify anything, it gets stored locally under the
.prefect
folder. The
Local Agent
would then find that flow locally and then run it. So for
Local Agent
and
Local Storage
, the machine where you registered needs to be the same as the machine you run it on. Now in this case, because you chose `DockerRu`n, I think it's going to pull a container down to run, but not find the flow there. This will work if you don't define the
run_config
or if you use
LocalRun()
instead to pair with your Local Agent
You can combine DockerRun with LocalStorage and the path supplied to storage will be the location of the flow inside the Docker container. I have a demo of this here
j
Thanks Kevin, I'll check it out!
k
Btw
DockerRun
is for pulling an image and running the flow on top of that image from the agent