https://prefect.io logo
#prefect-community
Title
# prefect-community
n

Nuno Silva

09/07/2020, 3:31 PM
Hi. quick question: starting the agent in the command line works fine when specifying the server url
Copy code
prefect agent start --api http://<url>:4200
but in code doesn't:
Copy code
from prefect.agent.local import LocalAgent
agent = LocalAgent(agent_address="http://<url>:4200")
agent.start()
fails with:
Copy code
/tornado/netutil.py", line 174, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
Any idea? thanks
n

nicholas

09/07/2020, 3:45 PM
Hi @Nuno Silva -
agent_address
as an arg to the
*Agent()
constructor tells Prefect to start an agent at that url/port. To set the endpoint that the Agent polls against, you'll instead want to set
server.endpoint
in your
~/.prefect/config.toml
.
n

Nuno Silva

09/07/2020, 4:02 PM
@nicholas perfect, it works. I did it with:
Copy code
os.environ["PREFECT__SERVER__ENDPOINT"] = f"{prefect_url}:4200"
thank you
n

nicholas

09/07/2020, 4:03 PM
Glad it works @Nuno Silva!