Javier King
07/18/2025, 7:39 PMprefect-default-workpool | 04:28:44.344 | DEBUG | prefect.events.clients - EventsClient(id=140326752162576): Emitting event id=019816a4-5165-755f-8b27-55e3ca2fb859.
prefect-default-workpool | /usr/local/lib/python3.12/site-packages/prefect/events/clients.py:441: UserWarning: Logger 'prefect.events.clients' attempted to send logs to the API without a flow run id. The API log handler can only send logs within flow run contexts unless the flow run id is manually provided. Set PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW=ignore to suppress this warning.
prefect-default-workpool | logger.debug(
prefect-default-workpool | 04:28:44.345 | DEBUG | prefect.events.clients - Added event id=019816a4-5165-755f-8b27-55e3ca2fb859 to unconfirmed events list. There are now 1 unconfirmed events.
prefect-default-workpool | 04:28:44.346 | DEBUG | prefect.events.clients - EventsClient(id=140326752162576): Emit reconnection attempt 0.
The flows are running and completing their tasks, but I believe this is resulting in the tasks not showing up in the UIMarvin
07/18/2025, 7:39 PMMarvin
07/18/2025, 7:40 PMLogger attempted to send logs to the API without a flow run id
) suggests that some logs are being generated outside of a proper flow run context. However, if tasks aren't showing up in the UI, this could be related to a broader issue with event propagation.
3. Potential Solutions:
a. If you want to suppress just the warnings:
bash
export PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW=ignore
b. For the broader issue of tasks not showing up in the UI, based on the GitHub issues, this could be related to:
- Event propagation issues between the worker and the server
- Timing issues with flow run context establishment
- Issues with the messaging system (especially if using Redis as a message broker)
4. Recommendations:
- Ensure your Prefect server and worker versions match exactly
- Check if you're using Redis as a message broker (as this has been associated with similar issues)
- Verify that your worker has proper connectivity to the Prefect server
- Consider upgrading to the latest Prefect version if you haven't already, as several related issues have been fixed in recent releases
5. Additional Context: The warning is actually a protective measure to alert you when logs might not be properly associated with their flow runs. While you can suppress it, the underlying cause might need investigation if it's affecting task visibility in the UI.
Would you be able to share:
1. Are you using Redis as a message broker?
2. What versions of Prefect are you running on both the server and worker side?
3. Are you seeing any other error messages in the logs besides this warning?
This information would help narrow down the exact cause and provide more specific solutions.Javier King
07/18/2025, 7:42 PMprefect-default-workpool | 04:29:13.654 | DEBUG | APILogWorkerThread | prefect._internal.concurrency - Running call get(timeout=1.9981156489811838) in thread 'APILogWorkerThread'
Marvin
07/18/2025, 7:42 PMMarvin
07/18/2025, 7:43 PMAPILogWorkerThread
) indicates that the worker is trying to process logs but might be having trouble with the event context.
3. Solutions:
a. First, try adjusting these environment variables:
bash
# Increase the websocket backfill to ensure events are properly captured
export PREFECT_SERVER_API_WEBSOCKET_BACKFILL_PAGE_SIZE=1000
export PREFECT_SERVER_API_MAXIMUM_WEBSOCKET_BACKFILL=10000
# Adjust Redis-specific settings
export PREFECT_EVENTS_MAXIMUM_RETENTION_DAYS=7
export PREFECT_EVENTS_PROACTIVE_GRANULARITY_SECONDS=60
b. If you're running in a containerized environment, ensure these settings are properly propagated to both the worker and server containers.
4. Alternative Approaches:
- Consider using the default SQLite-based messaging if your scale permits it
- If you must use Redis, ensure you're using the latest version of prefect-redis
- Monitor Redis memory usage and ensure it's not hitting memory limits
5. Verification Steps:
After implementing these changes, you can verify proper event propagation by:
- Checking if tasks appear properly in the UI
- Monitoring Redis logs for any connection or memory issues
- Verifying that flow run logs are properly associated with their runs
Would you like me to provide more specific configuration details for any of these solutions? Also, it would be helpful to know:
1. What version of prefect-redis
are you using?
2. Are you running this in a containerized environment?
3. Have you noticed any patterns in which types of tasks tend to disappear from the UI?