You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flows that reconfigure the python logger can cause deadlocks during deployment very similar to #9345
prefect3-deadlock.py:
fromprefectimportflowimportloggingfromlogging.configimportdictConfig# this happens for example when running "import anyscale" (see anyscale/__init__.py https://pypi.org/project/anyscale/)logger=logging.getLogger(__name__)
logger.setLevel("WARN")
print("This line is reached")
# this is a very simplified version of what happens in ray/_private/log.py (generate_logging_config)# it is called from ray/__init__.pydictConfig({"version": 1})
print("This line is never reached")
# when importing anyscale, the logger is configured,# then ray is imported by anyscale, which reconfigures the logger again.@flowdefmyflow():
pass
prefect.yaml:
# Welcome to your prefect.yaml file! You can use this file for storing and managing# configuration for deploying your flows. We recommend committing this file to source# control along with your flow code.# Generic metadata about this projectname: my-projectprefect-version: 3.1.4# build section allows you to manage and build docker imagesbuild: null# push section allows you to manage if and how this project is uploaded to remote locationspush: null# pull section allows you to provide instructions for cloning this project in remote locationspull:
- prefect.deployments.steps.set_working_directory:
directory: /my-project# the deployments section allows you to provide configuration for deploying flowsdeployments:
- name: testversion: nulltags: []description: nullschedule: {}flow_name: nullentrypoint: prefect3-deadlock.py:myflowparameters: {}work_pool:
name: testwork_queue_name: nulljob_variables: {}
How to reproduce:
create folder my-project, copy prefect3-deadlock.py and prefect.yaml
prefect worker start -p test to setup the worker
prefect deploy --all
Output: This line is reached Then hanging indefinitely. This line is never reached is never printed.
Version info
Version: 3.1.4
API version: 0.8.4
Python version: 3.11.9
Git commit: 78ee41cb
Built: Wed, Nov 20, 2024 7:37 PM
OS/Arch: linux/x86_64
Profile: local
Server type: server
Pydantic version: 2.9.2
Integrations:
prefect-aws: 0.5.1
prefect-ray: 0.4.2
Additional context
The same flow works fine in Prefect 2.20.14.
Since we are making heavy use of Ray and Anyscale, this is currently blocking us from adopting Prefect 3.
While this issue popped up using Anyscale, it is a general problem of Prefect 3 handling reconfiguration of the python logger.
The text was updated successfully, but these errors were encountered:
j-tr
changed the title
Deadlock when deloying flow wich dependencies that reconfigure the python logger
Deadlock when deloying flow with dependencies that reconfigure the python logger
Nov 26, 2024
Bug summary
Flows that reconfigure the python logger can cause deadlocks during deployment very similar to #9345
prefect3-deadlock.py:
prefect.yaml:
How to reproduce:
my-project
, copyprefect3-deadlock.py
andprefect.yaml
prefect worker start -p test
to setup the workerprefect deploy --all
Output:
This line is reached
Then hanging indefinitely.This line is never reached
is never printed.Version info
Additional context
The same flow works fine in Prefect 2.20.14.
Since we are making heavy use of Ray and Anyscale, this is currently blocking us from adopting Prefect 3.
While this issue popped up using Anyscale, it is a general problem of Prefect 3 handling reconfiguration of the python logger.
The text was updated successfully, but these errors were encountered: