https://prefect.io logo
Title
a

Alireza

02/14/2023, 2:04 PM
@Marvin I’ve got too many 429 errors on my local agent, is it because of my rate limit to call the api?
m

Marvin

02/14/2023, 2:04 PM
It is possible that your rate limit is too low and causing 429 errors, but there are a few other possibilities as well. It could be a problem with the API itself, or it could be caused by a networking issue or misconfigured settings on your local machine. Have you tried increasing the rate limit to see if that solves the problem?
a

Alireza

02/14/2023, 2:06 PM
@Marvin how can I check my organisation rate limit?
m

Marvin

02/14/2023, 2:09 PM
It sounds like you may need to check the rate limit for your organization, which could be causing the 429 errors you are seeing. Prefect offers the ability to control the maximum number of concurrent task runs for a given tag by setting an optional concurrency limit. You can set, list, and delete concurrency limits by using the Prefect CLI
concurrency-limit
commands, or programmatically using the
OrionClient.create_concurrency_limit
,
OrionClient.delete_concurrency_limit_by_tag
, and
OrionClient.read_concurrency_limit_by_tag
methods. Additionally, if you need to prevent too many tasks from running simultaneously, you can use the [
exponential_backoff
](/api-ref/prefect/tasks/#prefect.tasks.exponential_backoff) utility to generate a list of retry delays that correspond to an exponential backoff retry strategy. I hope this information was helpful and that it helps you solve your problem.
a

Alireza

02/14/2023, 2:17 PM
z

Zanie

02/14/2023, 5:01 PM
Are your 429s related to logs?
a

Alireza

02/14/2023, 8:27 PM
--- Orion logging error ---
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/logging/handlers.py", line 153, in send_logs
    await client.create_logs(self._pending_logs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/client/orion.py", line 1899, in create_logs
    await <http://self._client.post|self._client.post>(f"/logs/", json=serialized_logs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/httpx/_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/client/base.py", line 255, in send
    response.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/client/base.py", line 130, in raise_for_status
    raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
prefect.exceptions.PrefectHTTPStatusError: Client error '429 Too Many Requests' for url '<https://api.prefect.cloud/api/accounts/.../workspaces/.../logs/>'
Response: {'detail': 'Too Many Requests'}
For more information check: <https://httpstatuses.com/429>
Worker information:
    Approximate queue length: 1
    Pending log batch length: 13
    Pending log batch size: 5545
The log worker will attempt to send these logs again in 2.0s