Paweł Biernat
01/16/2025, 10:02 AMMarvin
01/16/2025, 10:02 AMPaweł Biernat
01/16/2025, 10:03 AMMarvin
01/16/2025, 10:03 AMMaxDepthExceeded
exception you're encountering is likely related to the Prefect server's handling of events and their associated resources. This exception can occur when the number of related resources for an event exceeds a predefined limit. Here are some details and potential solutions:
1. Issue Context: There is a known issue with Prefect deployments where a race condition can cause sub-deployments to be stuck in a "Cancelling" state when the parent deployment is cancelled. This might be related to your problem if you're using sub-deployments. More details can be found in this GitHub issue.
2. Configuration Limits: The Prefect server has configurable limits on the number of related resources an event can have. The default maximum is 500 related resources. You might be hitting this limit, causing the MaxDepthExceeded
exception. You can adjust this limit using the PREFECT_SERVER_EVENTS_MAXIMUM_RELATED_RESOURCES
environment variable. More configuration options are detailed in the Prefect settings reference.
3. Possible Solutions:
- Increase the Limit: If your use case involves a large number of related resources, consider increasing the maximum_related_resources
setting.
- Review Deployment Logic: If you are using sub-deployments, review your deployment logic to ensure that cancellations and state transitions are handled gracefully.
By adjusting these configurations and reviewing your deployment logic, you may be able to resolve the MaxDepthExceeded
exceptions. If the problem persists, consider reaching out to the Prefect community or opening a support ticket for further assistance.Paweł Biernat
01/16/2025, 10:05 AMMarvin
01/16/2025, 10:05 AMPaweł Biernat
01/16/2025, 10:07 AMMarvin
01/16/2025, 10:07 AMPREFECT_SERVER_SERVICES_CANCELLATION_CLEANUP_ENABLED
.
For further insights, you might want to monitor your server's resource usage and review how the cleanup service interacts with your flow runs. If the problem persists, consider reaching out to the Prefect community or support for more tailored advice.