Diego Lima
11/03/2023, 3:26 PMserve()
on a while True
? I don't know what's causing a RuntimeError
and it stops my code, so I needed to rerun constantly.
@flow(retries=3, retry_delay_seconds=5, log_prints=True)
def get_repo_info(repo_name: str = "PrefectHQ/prefect"):
...
if __name__ == "__main__":
while True:
try:
get_repo_info.serve(name="my-first-deployment")
except RuntimeError as e:
if e.args == ("this borrower is already holding one of this CapacityLimiter's tokens",):
print("Ran into that 'CapacityLimiter's tokens' issue. Restarting.")
continue
raise e
Marvin
11/03/2023, 3:27 PMRuntimeError
due to some issue with CapacityLimiter's tokens
. This might be related to resource allocation or rate limits in Prefect.
1. Resource Allocation: Make sure to allocate enough CPU and memory to your agent. Your agent needs enough resources to appropriately provision infrastructure for your flow runs and to monitor their execution. Otherwise, your flow runs may get stuck in a pending state. [^1^]
2. Rate Limits: API rate limits restrict the number of requests that a single client can make in a given time period. They ensure Prefect Cloud's stability, so that when you make an API call, you always get a response. Prefect Cloud rate limits are subject to change. Contact Prefect support at help@prefect.io if you have questions about current rate limits. [^3^]
However, these are just general suggestions. The specific issue you're facing might be due to some other reason. If you could provide more details about the error and the context in which it's occurring, I might be able to help you better.
[^1^]: Prefect Docs - Infrastructure
[^3^]: Prefect Docs - API Rate Limits & Retention PeriodsNate
11/03/2023, 3:28 PMDiego Lima
11/03/2023, 3:28 PMDiego Lima
11/03/2023, 3:28 PMChris White
Chris White
PREFECT_RUNNER_PROCESS_LIMIT
Chris White
Nate
11/03/2023, 3:29 PMfrom prefect import serve
instead of the Flow
method, it will also accept limit
as a kwargDiego Lima
11/03/2023, 3:30 PMDiego Lima
11/03/2023, 3:30 PMChris White
Diego Lima
11/03/2023, 3:32 PMDiego Lima
11/03/2023, 3:34 PM5
)Chris White
Diego Lima
11/03/2023, 3:35 PMDiego Lima
11/03/2023, 4:06 PMDiego Lima
11/03/2023, 4:07 PMChris White