Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The new release of Pytest Asyncio (0.25.1) makes some google tests flaky #45355

Open
potiuk opened this issue Jan 2, 2025 · 0 comments
Open
Labels
area:CI Airflow's tests and continious integration provider:google Google (including GCP) related issues Quarantine Issues that are occasionally failing and are quarantined

Comments

@potiuk
Copy link
Member

potiuk commented Jan 2, 2025

After Pytest-asyncio 0.25.1 our canary tests started to fail with "RuntimeError: There is no current event loop in thread 'MainThread'." This happens randomly - a lot of times in Python 3.12 non-db tests, but sometimes they succeed there, and fail in other Python versions. It happens with xdist with xdist n=1 and without xdist alike.

Example failures:

Stacktrace:

_ ERROR at setup of TestRunPipelineJobTrigger.test_run_yields_success_event_on_successful_pipeline_state[4] _
[gw2] linux -- Python 3.11.11 /usr/local/bin/python
src/python/grpcio/grpc/_cython/_cygrpc/aio/common.pyx.pxi:184: in grpc._cython.cygrpc.get_working_loop
    ???
E   RuntimeError: no running event loop

During handling of the above exception, another exception occurred:
providers/tests/google/cloud/triggers/test_vertex_ai.py:133: in pipeline_service_async_client
    return PipelineServiceAsyncClient(
/usr/local/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py:304: in __init__
    self._client = PipelineServiceClient(
/usr/local/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/pipeline_service/client.py:[889](https://github.com/apache/airflow/actions/runs/12583221724/job/35070671929#step:6:906): in __init__
    self._transport = transport_init(
/usr/local/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py:310: in __init__
    self._grpc_channel = channel_init(
/usr/local/lib/python3.11/site-packages/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py:177: in create_channel
    return grpc_helpers_async.create_channel(
/usr/local/lib/python3.11/site-packages/google/api_core/grpc_helpers_async.py:290: in create_channel
    return aio.secure_channel(
/usr/local/lib/python3.11/site-packages/grpc/aio/_channel.py:621: in secure_channel
    return Channel(
/usr/local/lib/python3.11/site-packages/grpc/aio/_channel.py:367: in __init__
    self._loop = cygrpc.get_working_loop()
src/python/grpcio/grpc/_cython/_cygrpc/aio/common.pyx.pxi:186: in grpc._cython.cygrpc.get_working_loop
    ???
src/python/grpcio/grpc/_cython/_cygrpc/aio/common.pyx.pxi:190: in grpc._cython.cygrpc.get_working_loop
    ???
/usr/local/lib/python3.11/asyncio/events.py:681: in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
E   RuntimeError: There is no current event loop in thread 'MainThread'.
_ ERROR at setup of TestRunPipelineJobTrigger.test_run_yields_success_event_on_successful_pipeline_state[8] _
[gw2] linux -- Python 3.11.11 /usr/local/bin/python
src/python/grpcio/grpc/_cython/_cygrpc/aio/common.pyx.pxi:184: in grpc._cython.cygrpc.get_working_loop
    ???
E   RuntimeError: no running event loop

Failing tests:

ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestRunPipelineJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[4] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestRunPipelineJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[8] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestRunPipelineJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[5] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestRunPipelineJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[7] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomTrainingJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[4] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomTrainingJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[8] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomTrainingJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[5] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomTrainingJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[7] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomContainerTrainingJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[4] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomContainerTrainingJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[8] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomContainerTrainingJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[5] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomContainerTrainingJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[7] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomPythonPackageTrainingJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[4] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomPythonPackageTrainingJobTrigger::test_run_yields_success_event_on_successful_pipeline_state[8] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomPythonPackageTrainingJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[5] - RuntimeError: There is no current event loop in thread 'MainThread'.
ERROR providers/tests/google/cloud/triggers/test_vertex_ai.py::TestCustomPythonPackageTrainingJobTrigger::test_run_yields_error_event_on_failed_pipeline_state[7] - RuntimeError: There is no current event loop in thread 'MainThread'.
@potiuk potiuk converted this from a draft issue Jan 2, 2025
@potiuk potiuk added the Quarantine Issues that are occasionally failing and are quarantined label Jan 2, 2025
@dosubot dosubot bot added area:CI Airflow's tests and continious integration provider:google Google (including GCP) related issues labels Jan 2, 2025
@shahar1 shahar1 closed this as completed Jan 4, 2025
@github-project-automation github-project-automation bot moved this from Flaky stuff to Done in CI / DEV ENV planned work Jan 4, 2025
@shahar1 shahar1 reopened this Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:CI Airflow's tests and continious integration provider:google Google (including GCP) related issues Quarantine Issues that are occasionally failing and are quarantined
Projects
Status: Done
Development

No branches or pull requests

2 participants