Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the default logging handler on warnings.warnings calls (#22267)
Summary: This ensures that warnings.warnings calls get basic logging information like timestamps and don't look totally different from other warnings Test Plan: Load the following code: ``` from dagster import AutoMaterializePolicy, asset @asset(auto_materialize_policy=AutoMaterializePolicy.lazy()) def my_asset(): print("HELLO") ``` Before, it looked like: ``` 2024-06-03 17:16:59 -0500 - dagster - INFO - Launching Dagster services... /Users/dgibson/dagster/python_modules/dagster/dagster/_core/definitions/auto_materialize_policy.py:243: ExperimentalWarning: Class `AutoMaterializePolicy` is experimental. It may break in future versions, even between dot releases. To mute warnings for experimental functionality, invoke warnings.filterwarnings("ignore", category=dagster.ExperimentalWarning) or use one of the other methods described at https://docs.python.org/3/library/warnings.html#describing-warning-filters. return AutoMaterializePolicy( /Users/dgibson/dagster/python_modules/dagster/dagster/_core/decorator_utils.py:203: ExperimentalWarning: Parameter `auto_materialize_policy` of function `asset` is experimental. It may break in future versions, even between dot releases. To mute warnings for experimental functionality, invoke warnings.filterwarnings("ignore", category=dagster.ExperimentalWarning) or use one of the other methods described at https://docs.python.org/3/library/warnings.html#describing-warning-filters. return fn(*args, **kwargs) ``` Now it looks like: ``` 2024-06-04 09:43:13 -0500 - dagster - INFO - Launching Dagster services... 2024-06-04 09:43:14 -0500 - dagster - WARNING - /Users/dgibson/dagster/python_modules/dagster/dagster/_core/definitions/auto_materialize_policy.py:247: ExperimentalWarning: Class `AutoMaterializePolicy` is experimental. It may break in future versions, even between dot releases. To mute warnings for experimental functionality, invoke warnings.filterwarnings("ignore", category=dagster.ExperimentalWarning) or use one of the other methods described at https://docs.python.org/3/library/warnings.html#describing-warning-filters. return AutoMaterializePolicy( 2024-06-04 09:43:14 -0500 - dagster - WARNING - /Users/dgibson/dagster/python_modules/dagster/dagster/_core/decorator_utils.py:203: ExperimentalWarning: Parameter `auto_materialize_policy` of function `asset` is experimental. It may break in future versions, even between dot releases. To mute warnings for experimental functionality, invoke warnings.filterwarnings("ignore", category=dagster.ExperimentalWarning) or use one of the other methods described at https://docs.python.org/3/library/warnings.html#describing-warning-filters. return fn(*args, **kwargs) ``` ## Summary & Motivation ## How I Tested These Changes
- Loading branch information