Thread
#prefect-community
    Lone Pine Account

    Lone Pine Account

    1 year ago
    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?
    Kevin Kho

    Kevin Kho

    1 year ago
    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?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    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?
    Kevin Kho

    Kevin Kho

    1 year ago
    I think if your agent is green in the UI, that means it should be fine. How are you running the flow? Quick run?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    yes
    Kevin Kho

    Kevin Kho

    1 year ago
    Both flow and agent only have one label? What type of agent are you using?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    local agent
    has only one label
    Kevin Kho

    Kevin Kho

    1 year ago
    How are you authenticating the agent?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    token
    do you know what port I get messages from the server upon?
    Kevin Kho

    Kevin Kho

    1 year ago
    Is it an env variable or do you pass it during agent start?
    I'll have to check for the port
    Lone Pine Account

    Lone Pine Account

    1 year ago
    [ec2-user@ip-172-31-46-102 ~]$ prefect agent local start -t xxxxx
     __      __      _    _          _ | _ \ _ __ _ / _| _ __| |   / \  __ _ _ _ _ | | | |) | '__/ _ \ | / _ / __| __|  / _ \ / ` |/ _ \ ' | __| | __/| | | __/ _| __/ (_| |  / _ \ (_| | _/ | | | | ||  |_|_| _|_|_| //  ___, |_|| ||_|                       |__/ [2021-05-13 13:33:33,828] INFO - agent | Starting LocalAgent with labels ['ip-172-31-46-102.us-east-2.compute.internal'] [2021-05-13 13:33:33,829] INFO - agent | Agent documentation can be found at https://docs.prefect.io/orchestration/ [2021-05-13 13:33:33,829] INFO - agent | Agent connecting to the Prefect API at https://api.prefect.io [2021-05-13 13:33:33,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
    Kevin Kho

    Kevin Kho

    1 year ago
    I think it's 4200. Like the UI doesn't show up?
    Could you run your agent in debug mode?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    sure - how do I do that?
    Kevin Kho

    Kevin Kho

    1 year ago
    prefect agent local start -log-level=DEBUG
    Lone Pine Account

    Lone Pine Account

    1 year ago
    [ec2-user@ip-172-31-46-102 ~]$ prefect agent local start -t --log-level=DEBUG [2021-05-13 13:50:55,828] DEBUG - agent | Verbose logs enabled [2021-05-13 13:50:55,828] DEBUG - agent | Environment variables: [] [2021-05-13 13:50:55,829] DEBUG - agent | Max polls: None [2021-05-13 13:50:55,829] DEBUG - agent | Agent address:  [2021-05-13 13:50:55,829] DEBUG - agent | Log to Cloud: True [2021-05-13 13:50:55,829] DEBUG - agent | Prefect backend: cloud [2021-05-13 13:50:55,829] DEBUG - agent | Import paths: [] [2021-05-13 13:50:55,829] DEBUG - agent | Show flow logs: False [2021-05-13 13:50:56,039] DEBUG - agent | Agent ID: 6925c9ee-cd70-4925-a718-8419d183c047  __      __      _    _          _ | _ \ _ __ _ / _| _ __| |   / \  __ _ _ _ _ | | | |) | '__/ _ \ | / _ / __| __|  / _ \ / ` |/ _ \ ' | __| | __/| | | __/ _| __/ (_| |  / _ \ (_| | _/ | | | | ||  |_|_| _|_|_| //  ___, |_|| ||_|                       |__/ [2021-05-13 13:50:56,039] INFO - agent | Starting LocalAgent with labels ['ip-172-31-46-102.us-east-2.compute.internal'] [2021-05-13 13:50:56,039] INFO - agent | Agent documentation can be found at https://docs.prefect.io/orchestration/ [2021-05-13 13:50:56,039] INFO - agent | Agent connecting to the Prefect API at https://api.prefect.io [2021-05-13 13:50:56,127] INFO - agent | Waiting for flow runs... [2021-05-13 13:50:56,128] DEBUG - agent | Running agent heartbeat... [2021-05-13 13:50:56,132] DEBUG - agent | Max Workers: 6 [2021-05-13 13:50:56,132] DEBUG - agent | Sleeping heartbeat for 60.0 seconds [2021-05-13 13:50:56,133] DEBUG - agent | Querying for flow runs [2021-05-13 13:50:56,249] DEBUG - agent | No flow runs found [2021-05-13 13:50:56,250] DEBUG - agent | Next query for flow runs in 0.5 seconds [2021-05-13 13:50:56,750] DEBUG - agent | Querying for flow runs [2021-05-13 13:50:56,842] DEBUG - agent | No flow runs found [2021-05-13 13:50:56,843] DEBUG - agent | Next query for flow runs in 1.0 seconds [2021-05-13 13:50:57,843] DEBUG - agent | Querying for flow runs [2021-05-13 13:50:57,935] DEBUG - agent | No flow runs found [2021-05-13 13:50:57,935] DEBUG - agent | Next query for flow runs in 2.0 seconds [2021-05-13 13:50:59,935] DEBUG - agent | Querying for flow runs [2021-05-13 13:51:00,067] DEBUG - agent | No flow runs found [2021-05-13 13:51:00,068] DEBUG - agent | Next query for flow runs in 4.0 seconds [2021-05-13 13:51:04,068] DEBUG - agent | Querying for flow runs [2021-05-13 13:51:04,162] DEBUG - agent | No flow runs found [2021-05-13 13:51:04,163] DEBUG - agent | Next query for flow runs in 8.0 seconds
    Kevin Kho

    Kevin Kho

    1 year ago
    Seems alright. I guess try a quick run while this is up?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    sure - just keeps saying "No Flow runs found"
    and on the UI it's "Scheduled to start"
    Kevin Kho

    Kevin Kho

    1 year ago
    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.
    Lone Pine Account

    Lone Pine Account

    1 year ago
    ya so I didn't really understand the whole tenant thing
    ok so NOW its saying it lost communication with the agnet
    Kevin Kho

    Kevin Kho

    1 year ago
    Your agent turned red?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    yellow
    Kevin Kho

    Kevin Kho

    1 year ago
    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?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    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
    Kevin Kho

    Kevin Kho

    1 year ago
    What error do you get? When deleting agents or even stuff like flows?
    Lone Pine Account

    Lone Pine Account

    1 year ago
    when I try to clear up agents I get a "Error clearing agents" popup at the bottom
    I'm able to delete flows
    Kevin Kho

    Kevin Kho

    1 year ago
    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?.
    Lone Pine Account

    Lone Pine Account

    1 year ago
    I press that and get the error
    Kevin Kho

    Kevin Kho

    1 year ago
    Ah I see. Will bring that up to the team.
    Lone Pine Account

    Lone Pine Account

    1 year ago
    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
    Kevin Kho

    Kevin Kho

    1 year ago
    More docs on labels