Hello, If i have my python code on Machine 1, then...
# ask-community
i
Hello, If i have my python code on Machine 1, then make a flow and register it... then I launch an agent from Machine 2, would it be able to launch the initial flow? If no, what's the appropriate way to handle similar scenarios?
m
Hello Issam! Yes, it’s common scenario when flows are executed on one machine, but agent is running on a different machine! I would recommend to start with running a test flow using Prefect Cloud. As you mentioned: you write a flow, register it with Prefect Cloud, then you can create a API key, which you are going to use for your agent. Start your agent with
prefect agent <type of agent> start --key <api key>
and now your agent should be able to deploy your flows. Note, if you are setting any labels on your flow, make sure you agent has the same labels. I would recommend to go through this doc, let us know if you’ll have any questions.
k
Hey @Issam Assafi, when you register flows, they are stored in
Storage
. The default storage is
Local
so if you don’t specify anything, that serialized Flow will live on Machine1 and Machine2 won’t be able to launch it. You need to store your flow on Github,S3,Docker, or somewhere that Machine2 can pull it from. For more info, check the storage docs .
i
@Kevin Kho Let's say to run this flow, you need to have some specific python libraries and maybe even Google's Tesseract, do all machines need to have this environment installed? if yes, is there a way to package the flow with its whole environment?
k
Yes, and DockerStorage would be the way. I have a sample repo of packaging the Python library and making the Docker container if you are interested.
i
Yes can you please share the link?
k
Check this and this