Hi, How to register, `flow.register(...)`, a docke...
# prefect-server
y
Hi, How to register,
flow.register(...)
, a docker agent ? Can I have different docker agents running on a single server?
k
Yes you can have multiple agents on a single server, but why do you need multiple docker agents? The Docker agent will spin up a new container anyway. I think the only time you would need multiple is if you had different labels on them. You just need to attach the
DockerRun
to your Flow
upvote 1
y
I am trying to find a solution to the situation that the registered tasks are running as the user used to start the agent on a machine. This is causing issues when multiple users, with different permissions are using the same machine. I was thinking that maybe each user, will stat its own agent, but was worried it will create a mess, so I was wondering if doing it with docker agents might be the way to go
k
Multiple agents may solve this. I’m not 100% sure. As long as you can keep them running simultaneously, I guess it could work
y
what is not so clear to me, is how to register the flow with a specific agent, if both agents are running on the same machine at the same time
k
It would be by adding labels
y
So, it should looks like: On a single server User 1 - Start agent
prefect agent local start -l team_1
User 2 - Start agent
prefect agent local start -l team_2
Then to register the flow User - 1
Copy code
flow.register(project_name="some project", labels=['team_1'])
User - 2
Copy code
flow.register(project_name="some other project", labels=['team_2'])
Is this correct ? is this how it works with the enterprise Prefect as well?
k
Yes exactly and yes it’s the same on Prefect Cloud
y
thanks, will try that
Worked well Thanks
👍 1