Hey everyone, I have got the docker agent working...
# prefect-community
s
Hey everyone, I have got the docker agent working with GPU based on the instructions from @Kevin Kho. But how do I run a flow locally in the agent and not by spinning up a new docker agent? The problem with this is that the new docker agent being created by prefect when triggered by the flow is actually not having runtime as Nvidia and doesn't see the Nvidia drivers and devices which makes it run in CPU. So I would like to know if it is possible to run the flow in the docker agent itself with starting a new Docker agent for the Docker run? Thanks, Sen
k
Hey @Sen, a bit confused by the phrasing. Do you mean spinning up a docker container (rather than agent)? The Docker agent spins a container to run the flow in. If you want to run it inside the same container, I think you’d need a local agent in a docker container of that you create
s
@Kevin Kho yeah you are right.. I meant spinning up a docker container to run the flow.. The new docker container being brought up to run the flow can't access the GPU..
Copy code
# Starting the Prefect DockerAgent
    prefect_agent = DockerAgent(
        env_vars=env_vars,
        name="TranslationEvaluator Agent",
        no_pull=True,
        volumes=[input_mount],
        labels=["On_Prem_TranslationEvaluator_Dockerized", f"IP:{HOST_IP}", "GPU"],
        show_flow_logs=True,
    )

    prefect_agent.start()
So instead of doing this in the container.. you mean to say I need to start a local agent.. is that right?
k
Yeah…Then you would have to use the Local Agent instead of Docker Agent because Docker Agent spins up a new container. So you can run the Local Agent inside a Docker container I guess and the flow will run in the container.
Yeah that’s right
s
and in the flow.. do I need to change my run_config and storage as well
k
RunConfig can’t use DockerRun anymore so you need LocalRun, but you should not need to change storage
👍 1