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

Complete the new TA pipeline implementations #1033

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

joseph-sentry
Copy link
Contributor

  • creates the new cache analytics task
  • creates the new ta process flakes task
  • TA finisher uses new TADriver interface and ta_utils
  • TA finisher queues up new tasks

- generalize the way bigquery accepts query parameters
- change type of params arg in bigquery_service to sequence
- feat: add upload_id field to ta_testrun protobuf
- add flags_hash field to ta_testrun protobuf
- create new testid generation function
- add test_id to ta_testrun proto
- add flaky_failure to testrun protobuf
- handle flaky failures in ta_storage.bq
- create sql queries for reading from bq
- write tests for ta_storage.bq aggregate queries
Improve TADriver interface

- add some more methods to the TADriver
- implement a base constructor
- modify the write_testruns interface
- implement all methods in BQ and PG
- improve BQ and PG tests
- modify use of TADriver interface in processor and finishers
- update django settings to include new settings
- TODO: modify requirements to suitable shared version
- create ta_utils to replace test_results in the future
  - the reason for this is that we want a slightly different implementation
    of the test results notifier for the new TA pipeline
Copy link

codecov bot commented Jan 24, 2025

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
12 12 0 0
View the top 3 failed tests by shortest run time
tasks/tests/integration/test_ghm_sync_plans.py::tasks.tests.integration.test_ghm_sync_plans
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_ghm_sync_plans.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)
tasks/tests/integration/test_http_request_task.py::tasks.tests.integration.test_http_request_task
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_http_request_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)
tasks/tests/integration/test_send_email_task.py::tasks.tests.integration.test_send_email_task
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_send_email_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-staging
Copy link

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
12 12 0 0
View the top 3 failed tests by shortest run time
tasks/tests/integration/test_http_request_task.py::tasks.tests.integration.test_http_request_task
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_http_request_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)
tasks/tests/integration/test_notify_task.py::tasks.tests.integration.test_notify_task
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_notify_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)
tasks/tests/integration/test_status_set_pending_task.py::tasks.tests.integration.test_status_set_pending_task
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_status_set_pending_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link

codecov-qa bot commented Jan 24, 2025

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
12 12 0 0
View the top 3 failed tests by shortest run time
tasks/tests/integration/test_ghm_sync_plans.py::tasks.tests.integration.test_ghm_sync_plans
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_ghm_sync_plans.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)
tasks/tests/integration/test_status_set_pending_task.py::tasks.tests.integration.test_status_set_pending_task
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_status_set_pending_task.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)
tasks/tests/integration/test_timeseries_backfill.py::tasks.tests.integration.test_timeseries_backfill
Stack Traces | 0s run time
ImportError while importing test module '.../tests/integration/test_timeseries_backfill.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../local/lib/python3.13/importlib/__init__.py:88: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/__init__.py:52: in <module>
    from tasks.ta_finisher import ta_finisher_task
tasks/ta_finisher.py:47: in <module>
    from tasks.ta_cache_analytics import ta_cache_analytics_task
tasks/ta_cache_analytics.py:5: in <module>
    from shared.django_apps.test_analytics.models import LastRollupDate
E   ImportError: cannot import name 'LastRollupDate' from 'shared.django_apps.test_analytics.models' (.../local/lib/python3.13.../django_apps/test_analytics/models.py)

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
12 12 0 0
View the top 3 failed tests by shortest run time
tasks/tests/integration/test_ai_pr_review.py::::tasks.tests.integration.test_ai_pr_review
Stack Traces | 0s run time
No failure message available
tasks/tests/integration/test_sync_pull.py::::tasks.tests.integration.test_sync_pull
Stack Traces | 0s run time
No failure message available
tasks/tests/integration/test_upload_e2e.py::::tasks.tests.integration.test_upload_e2e
Stack Traces | 0s run time
No failure message available

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

❌ 24 Tests Failed:

Tests completed Failed Passed Skipped
24 24 0 0
View the top 3 failed tests by shortest run time
services.tests.test_repository_service
Stack Traces | 0.000s run time
No failure message available
tasks.tests.integration.test_ai_pr_review
Stack Traces | 0.000s run time
No failure message available
tasks.tests.integration.test_ghm_sync_plans
Stack Traces | 0.000s run time
No failure message available

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

Flake.count != (Flake.recent_passes_count + Flake.fail_count),

def get_postgres_test_data(
db_session: Session, repo: Repository, commit_sha: str, commit_yaml: UserYaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the repo and commit_yaml are only used to initialize the driver, and for the should_do_flaky_detection check.
instead, you could pass the driver and that flag from the outside. That way you only need a single function instead of two.

# get all uploads pending process flakes in the entire repo? why stop at a given commit :D
uploads_to_process = ReportSession.objects.filter(
report__report_type=CommitReport.ReportType.TEST_RESULTS.value,
report__commit__repository__repoid=repo_id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
report__commit__repository__repoid=repo_id,
report__commit__repository=repo_id,

Not sure if the ORM is smart enough to do this automatically, but this could potentially avoid a join on repository.


if settings.BIGQUERY_WRITE_ENABLED:
bq = BQDriver(repo_id)
bq.write_flakes([upload for upload in uploads_to_process])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bq.write_flakes([upload for upload in uploads_to_process])
bq.write_flakes(list(uploads_to_process))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants