Hi i am trying to register a flow from agent . On ...
# prefect-community
Hi i am trying to register a flow from agent . On the GUI the agent is connected but when i try to register the flow I get this error:
Copy code
File "/home/infra/prefect_server/lib/python3.8/site-packages/prefect/client/client.py", line 603, in _send_request
    response = <http://session.post|session.post>(
  File "/home/infra/prefect_server/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/home/infra/prefect_server/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/infra/prefect_server/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/home/infra/prefect_server/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=4200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f3be9b9e700>: Failed to establish a new connection: [Errno 111] Connection refused'))
Example: My GUI server is hosted on Machine A and one agent is Machine B, the code present on Machine B is to be run and registered on Machine B but should show its task on the Machine A GUI.
This looks like an error from GraphQL. You would need to add this to your –/.prefect/config.toml from the machine on which you register your flow to Server:
Copy code
endpoint = "<http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>"

    apollo_url = "<http://YOUR_MACHINES_PUBLIC_IP:4200/graphql>"
This is required so that Prefect knows which API endpoint to talk to.
Thanks it worked
👍 1