Hello community - I'm getting started with my firs...
# ask-community
l
Hello community - I'm getting started with my first flow. I've set up an EC2 instance to house my code and the agent, registered a flow, fired up the agent (which is seen by the cloud server). When I run my flow . . . nothing happens. The agent just says "Waiting for flow runs . . ." What am I missing?
k
Hi! This is likely a label mismatch issue. Can you check what the labels of the flow are and what the labels of the agent are?
l
labels seem to be identical
'ip-172-31-46-102.us-east-2.compute.internal'
which is the internal IP for the EC2 instance
Do I maybe need to open some ports on my EC2 instance so that the server can send me messages?
k
I think if your agent is green in the UI, that means it should be fine. How are you running the flow? Quick run?
l
yes
k
Both flow and agent only have one label? What type of agent are you using?
l
local agent
has only one label
k
How are you authenticating the agent?
l
token
do you know what port I get messages from the server upon?
k
Is it an env variable or do you pass it during agent start?
I'll have to check for the port
l
[ec2-user@ip-172-31-46-102 ~]$ prefect agent local start -t xxxxx
 __      __      _    _          _ | _ \ _ __ _ / _| _ ___| |_   / \  __ _ _ _ _ | | | |_) | '__/ _ \ |_ / _ \/ __| __|  / _ \ / _` |/ _ \ '_ \| __| | __/| | | __/ _| __/ (_| |  / _ \ (_| | _/ | | | | |_|  |_| \___|_| \___|\___|\__| /_/  \_\__, |\___|_| |_|\__|                       |___/ [2021-05-13 133333,828] INFO - agent | Starting LocalAgent with labels ['ip-172-31-46-102.us-east-2.compute.internal'] [2021-05-13 133333,829] INFO - agent | Agent documentation can be found at https://docs.prefect.io/orchestration/ [2021-05-13 133333,829] INFO - agent | Agent connecting to the Prefect API at https://api.prefect.io [2021-05-13 133333,911] INFO - agent | Waiting for flow runs...
not sure if this is related, but I'm also unable to get the server to run on my ec2 instance - I get the "grey screen" that I've heard talked about on here
k
I think it's 4200. Like the UI doesn't show up?
Could you run your agent in debug mode?
l
sure - how do I do that?
k
prefect agent local start -log-level=DEBUG
l
[ec2-user@ip-172-31-46-102 ~]$ prefect agent local start -t --log-level=DEBUG [2021-05-13 135055,828] DEBUG - agent | Verbose logs enabled [2021-05-13 135055,828] DEBUG - agent | Environment variables: [] [2021-05-13 135055,829] DEBUG - agent | Max polls: None [2021-05-13 135055,829] DEBUG - agent | Agent address:  [2021-05-13 135055,829] DEBUG - agent | Log to Cloud: True [2021-05-13 135055,829] DEBUG - agent | Prefect backend: cloud [2021-05-13 135055,829] DEBUG - agent | Import paths: [] [2021-05-13 135055,829] DEBUG - agent | Show flow logs: False [2021-05-13 135056,039] DEBUG - agent | Agent ID: 6925c9ee-cd70-4925-a718-8419d183c047  __      __      _    _          _ | _ \ _ __ _ / _| _ ___| |_   / \  __ _ _ _ _ | | | |_) | '__/ _ \ |_ / _ \/ __| __|  / _ \ / _` |/ _ \ '_ \| __| | __/| | | __/ _| __/ (_| |  / _ \ (_| | _/ | | | | |_|  |_| \___|_| \___|\___|\__| /_/  \_\__, |\___|_| |_|\__|                       |___/ [2021-05-13 135056,039] INFO - agent | Starting LocalAgent with labels ['ip-172-31-46-102.us-east-2.compute.internal'] [2021-05-13 135056,039] INFO - agent | Agent documentation can be found at https://docs.prefect.io/orchestration/ [2021-05-13 135056,039] INFO - agent | Agent connecting to the Prefect API at https://api.prefect.io [2021-05-13 135056,127] INFO - agent | Waiting for flow runs... [2021-05-13 135056,128] DEBUG - agent | Running agent heartbeat... [2021-05-13 135056,132] DEBUG - agent | Max Workers: 6 [2021-05-13 135056,132] DEBUG - agent | Sleeping heartbeat for 60.0 seconds [2021-05-13 135056,133] DEBUG - agent | Querying for flow runs [2021-05-13 135056,249] DEBUG - agent | No flow runs found [2021-05-13 135056,250] DEBUG - agent | Next query for flow runs in 0.5 seconds [2021-05-13 135056,750] DEBUG - agent | Querying for flow runs [2021-05-13 135056,842] DEBUG - agent | No flow runs found [2021-05-13 135056,843] DEBUG - agent | Next query for flow runs in 1.0 seconds [2021-05-13 135057,843] DEBUG - agent | Querying for flow runs [2021-05-13 135057,935] DEBUG - agent | No flow runs found [2021-05-13 135057,935] DEBUG - agent | Next query for flow runs in 2.0 seconds [2021-05-13 135059,935] DEBUG - agent | Querying for flow runs [2021-05-13 135100,067] DEBUG - agent | No flow runs found [2021-05-13 135100,068] DEBUG - agent | Next query for flow runs in 4.0 seconds [2021-05-13 135104,068] DEBUG - agent | Querying for flow runs [2021-05-13 135104,162] DEBUG - agent | No flow runs found [2021-05-13 135104,163] DEBUG - agent | Next query for flow runs in 8.0 seconds
k
Seems alright. I guess try a quick run while this is up?
l
sure - just keeps saying "No Flow runs found"
and on the UI it's "Scheduled to start"
k
I assume your prefect account only has one tenant for now? I’m wondering if the API key is for a different tenant than that flow is on.
l
ya so I didn't really understand the whole tenant thing
ok so NOW its saying it lost communication with the agnet
k
Your agent turned red?
l
yellow
k
Can you try running your agent on your local machine and passing the same label so we know if it’s something related to EC2 setup?
l
ugh - now I can't clear out these old agents
is there a way to take the cloud instance to some "clean" state - I keep getting errors on deleting things
k
What error do you get? When deleting agents or even stuff like flows?
l
when I try to clear up agents I get a "Error clearing agents" popup at the bottom
I'm able to delete flows
k
I’m not having issues when I delete agents on my side….do you see the “Clean up” button on the top right of the agents tab though?.
l
I press that and get the error
k
Ah I see. Will bring that up to the team.
l
Ok the agents eventually went away. I deleted everything, re-registered the flow, created the agent . . . same result. Appears the server is not sending start requests to my EC2 instance where the agent sits.
Final answer here - my "Agent" labels were not matching my "Flow" labels so the agent wasn't picking up the flow
👍 2
k
More docs on labels