[21 June 2021 1:41pm]: Failed to load and execute Flow's environment: ModuleNotFoundError("No module named '/root/'")
k
Kevin Kho
06/21/2021, 5:45 PM
Hey @Joe, what RunConfig and Agent are you using?
j
Joe
06/21/2021, 6:58 PM
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
Kevin Kho
06/21/2021, 6:59 PM
Are you using any Storage for the flow?
j
Joe
06/21/2021, 6:59 PM
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"])
Joe
06/21/2021, 7:00 PM
Not that I'm aware of - do I need to set up some sort of storage to run a Hello World?
k
Kevin Kho
06/21/2021, 7:03 PM
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
Kevin Kho
06/21/2021, 7:05 PM
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
Joe
06/21/2021, 7:22 PM
Thanks Kevin, I'll check it out!
k
Kevin Kho
06/21/2021, 7:29 PM
Btw
DockerRun
is for pulling an image and running the flow on top of that image from the agent
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.