https://prefect.io logo
Title
r

rafaqat ali

03/02/2021, 12:41 PM
Hi team, I have run prefect agent local start command and it gives me error:No Agent Api token provided I'm running server and not cloud. Can any guide me, how can I generate this token for server?
g

Greg Roche

03/02/2021, 12:45 PM
Have you run
prefect backend server
before running
prefect agent local start
?
r

rafaqat ali

03/02/2021, 12:46 PM
I have run docker-compose up command only
g

Greg Roche

03/02/2021, 12:47 PM
Then run
prefect backend server
before starting the agent. You don't need to generate any tokens in order for agents to be able to connect to Prefect Server.
r

rafaqat ali

03/02/2021, 12:47 PM
thanks
I have run the command: prefect agent docker start and docker agent is created successfully and I'm able to see in UI. But, when I run the flow from UI, all the tasks are getting late run and not running successfully.
g

Greg Roche

03/02/2021, 1:05 PM
Could be a bunch of different things, but a common beginner pitfall is labels: your flow must have the same labels as the agent (or at least, the flow needs a subset of the agent's labels) https://docs.prefect.io/orchestration/execution/overview.html#labels
You deleted your screenshot, but the flow had a label that the agent did not have, so the agent would not execute runs of that flow. From the documentation I linked:
On the other hand if you register a flow that has environment labels set to 
["dev", "staging"]
 and run an Agent with the labels 
["dev"]
 then it will not pick up the flow because there exists labels in the environment which were not provided to the agent.
r

rafaqat ali

03/02/2021, 1:36 PM
Thank you, got your point
Now, flows are executed successfully. But for every flow, I got the error Failed to load and execute Flow's environment: ModuleNotFoundError("No module named 'C'")
Agent is running on different machine and I'm registering flow from different machine.
Code that I'm using to register the flow is:
with Flow("Test run", run_config=DockerRun(labels=["dev"])) as flow:
            flow.add_task(say_hello())
        flow.register("Test")
Can anyone guide me about the issue I'm facing in flow run from UI: Failed to load and execute Flow's environment: AttributeError("'NoneType' object has no attribute 'rstrip'") My flow storage is on azure blob. When I execute the flow from UI, I got the error
g

Greg Roche

03/02/2021, 3:11 PM
As this channel is for questions related to Prefect Server you'll probably get more views in #prefect-community. It doesn't seem like this issue is related to Prefect Server because the error message suggests there is a problem within the logic of your flow, because at some point the code is trying to run
foo.rstrip()
where the value of
foo
is
None
.
foo = None
foo.rstrip("a")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'rstrip'
r

rafaqat ali

03/02/2021, 4:01 PM
My agent is running on different machine and I'm registering flow from different machine? is this the issue you think?