Skip to content

Commit

Permalink
Reproduce asyncio failure with stackdriver leaking pytest fixture tasks
Browse files Browse the repository at this point in the history
There is a very strange error in our test suite which only occurs in
Postgres + Python 3.10 combination of tests where apparently a
non-cancelled test from pytest-asyncio fixtured event loop is cancelled
much later in different tests, producing an unexpected log entry and
failing TestGetGcpCredentialsAndProjectId.test_disable_logging.

See apache#36440 and likely the
root cause is pytest-dev/pytest-asyncio#200

This PR will allow to test the hypothesis and might help to iterate
over potential solutions.
  • Loading branch information
potiuk committed Dec 27, 2023
1 parent 78b2d82 commit 7a3ba7e
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions airflow/providers/google/cloud/log/stackdriver_task_handler.py
Expand Up @@ -30,21 +30,13 @@

from airflow.providers.google.cloud.utils.credentials_provider import get_credentials_and_project_id
from airflow.providers.google.common.consts import CLIENT_INFO
from airflow.utils.log.trigger_handler import ctx_indiv_trigger

if TYPE_CHECKING:
from contextvars import ContextVar

from google.auth.credentials import Credentials

from airflow.models import TaskInstance

try:
# todo: remove this conditional import when min airflow version >= 2.6
ctx_indiv_trigger: ContextVar | None
from airflow.utils.log.trigger_handler import ctx_indiv_trigger
except ImportError:
ctx_indiv_trigger = None

DEFAULT_LOGGER_NAME = "airflow"
_GLOBAL_RESOURCE = Resource(type="global", labels={})

Expand Down

0 comments on commit 7a3ba7e

Please sign in to comment.