Does anyone know if the local Prefect server is su...
# prefect-server
d
Does anyone know if the local Prefect server is supposed to work with
DockerAgent
? I'm trying the example flow from the tutorial:
Copy code
from prefect import Flow
from prefect import task
from prefect.run_configs import DockerRun


@task
def add(x, y=1):
    return x + y


with Flow("My first flow!", run_config=DockerRun()) as flow:
    first_result = add(1, y=2)
    second_result = add(x=first_result, y=100)

flow.register(project_name="test-project")
I submit the flow using the "Quick Run" button in the UI and start a Docker agent:
Copy code
prefect agent docker start --show-flow-logs --log-level DEBUG
But the run forever stays in the pending state and I only ever see
Querying for flow runs / No flow runs found
in the agent logs. I've tried
DockerRun()
as above and also using a custom image containing only this:
Copy code
FROM python:3.8-buster
RUN pip install prefect
The UI shows it can reach my agent, though. Any ideas?
k
Hi @Devin McCabe! What are your Flow labels?
d
Haven't applied labels anywhere yet
Also, the local agent works fine. Picks up the run right away
k
The flow can get a label from where it was registered from (and local agent gets the label by default as well). I think they might have matched that way by default.
So it helps to just confirm the flow as
None
under labels
d
Hmm, It seems a label was automatically applied when I registered the flow:
Copy code
python pipeline/test.py
Flow URL: <http://localhost:8080/default/flow/ca78b43a-4077-462e-9634-e4248cc7def8>
 └── ID: 97fec098-4383-4a70-acd5-2133a1706e3b
 └── Project: test-project
 └── Labels: ['CA-dpm-hu']
That's my computer name. Where did that label come from?
The flow does run when I manually remove that label in the UI
k
That is applied by default on the Flow when you register and on the local agent when it starts.
None
must match with
None
to pick up the Flow.
You can do
labels = None
when you register.
d
Ah, I see. Thanks. I would think that
run prefect agent local start
and
run prefect agent docker start
would behave identically (aside from in the obvious way). The simplest possible LocalAgent+Flow example works only because the same magic label gets applied at both ends. Changing that recipe in a small way without reproducing that functionality breaks things. Kind of confusing.
k
I understand yeah. And
None
is a label in itself also. This is something we’re thinking about.. You can use the
--no-hostname-label
option for the local agent when spinning it up.