From a4aa5cc900b5af4f263e2e612dec19d213d27a5c Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Wed, 25 Oct 2023 17:25:01 +0100 Subject: [PATCH] Remove unnecessary stack trace from Cosmos initialization (#624) As of Cosmos 1.2.0, whenever imported, the library would print a long stack trace related to Openlineage if it was not available as a warning. Change only to print the stack trace if DEBUG log mode is used. --- cosmos/operators/local.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cosmos/operators/local.py b/cosmos/operators/local.py index 489a92ba9..a593101fc 100644 --- a/cosmos/operators/local.py +++ b/cosmos/operators/local.py @@ -57,7 +57,10 @@ from openlineage.airflow.extractors.base import OperatorLineage except (ImportError, ModuleNotFoundError): logger.warning( - "To enable emitting Openlineage events, upgrade to Airflow 2.7 or install astronomer-cosmos[openlineage].", + "To enable emitting Openlineage events, upgrade to Airflow 2.7 or install astronomer-cosmos[openlineage]." + ) + logger.debug( + "Further details on lack of Openlineage:", stack_info=True, ) is_openlineage_available = False