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

Make ReportService sync #660

Merged
merged 1 commit into from
Aug 30, 2024
Merged

Make ReportService sync #660

merged 1 commit into from
Aug 30, 2024

Conversation

Swatinem
Copy link
Contributor

It looks like historically there is a mix of sync/async code.
The consensus(?) seems to favor sync code as celery is fundamentally sync.
Async code also does not play as well with profiling, which will not show the async code directly in a flamegraph, instead just inserting a wait for the async code running in a different thread.

@Swatinem Swatinem requested a review from a team August 29, 2024 15:15
@Swatinem Swatinem self-assigned this Aug 29, 2024
@codecov-notifications
Copy link

codecov-notifications bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 97.75281% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files Patch % Lines
services/report/__init__.py 91.30% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #660      +/-   ##
==========================================
- Coverage   98.06%   97.93%   -0.13%     
==========================================
  Files         437      437              
  Lines       36892    36864      -28     
==========================================
- Hits        36179    36104      -75     
- Misses        713      760      +47     
Flag Coverage Δ
integration 97.93% <97.75%> (-0.13%) ⬇️
latest-uploader-overall 97.93% <97.75%> (-0.13%) ⬇️
unit 97.93% <97.75%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.62% <92.59%> (-0.32%) ⬇️
OutsideTasks 98.03% <97.70%> (-0.03%) ⬇️
Files Coverage Δ
services/bundle_analysis/report.py 100.00% <100.00%> (ø)
services/notification/notifiers/tests/conftest.py 100.00% <100.00%> (ø)
services/test_results.py 90.10% <100.00%> (ø)
services/tests/test_report.py 100.00% <100.00%> (ø)
tasks/preprocess_upload.py 98.14% <100.00%> (ø)
tasks/upload.py 96.19% <100.00%> (ø)
services/report/__init__.py 96.31% <91.30%> (-1.08%) ⬇️

... and 2 files with indirect coverage changes

@codecov-qa
Copy link

codecov-qa bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 97.75281% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.93%. Comparing base (3cdf975) to head (67e5adc).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/report/__init__.py 91.30% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #660      +/-   ##
==========================================
- Coverage   98.06%   97.93%   -0.13%     
==========================================
  Files         437      437              
  Lines       36892    36864      -28     
==========================================
- Hits        36179    36104      -75     
- Misses        713      760      +47     
Flag Coverage Δ
integration 97.93% <97.75%> (-0.13%) ⬇️
latest-uploader-overall 97.93% <97.75%> (-0.13%) ⬇️
unit 97.93% <97.75%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.62% <92.59%> (-0.32%) ⬇️
OutsideTasks 98.03% <97.70%> (-0.03%) ⬇️
Files with missing lines Coverage Δ
services/bundle_analysis/report.py 100.00% <100.00%> (ø)
services/notification/notifiers/tests/conftest.py 100.00% <100.00%> (ø)
services/test_results.py 90.10% <100.00%> (ø)
services/tests/test_report.py 100.00% <100.00%> (ø)
tasks/preprocess_upload.py 98.14% <100.00%> (ø)
tasks/upload.py 96.19% <100.00%> (ø)
services/report/__init__.py 96.31% <91.30%> (-1.08%) ⬇️

... and 2 files with indirect coverage changes

Copy link

codecov-public-qa bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 97.75281% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.93%. Comparing base (3cdf975) to head (67e5adc).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #660      +/-   ##
==========================================
- Coverage   98.06%   97.93%   -0.13%     
==========================================
  Files         437      437              
  Lines       36892    36864      -28     
==========================================
- Hits        36179    36104      -75     
- Misses        713      760      +47     
Flag Coverage Δ
integration 97.93% <97.75%> (-0.13%) ⬇️
latest-uploader-overall 97.93% <97.75%> (-0.13%) ⬇️
unit 97.93% <97.75%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.62% <92.59%> (-0.32%) ⬇️
OutsideTasks 98.03% <97.70%> (-0.03%) ⬇️
Files Coverage Δ
services/bundle_analysis/report.py 100.00% <100.00%> (ø)
services/notification/notifiers/tests/conftest.py 100.00% <100.00%> (ø)
services/test_results.py 90.10% <100.00%> (ø)
services/tests/test_report.py 100.00% <100.00%> (ø)
tasks/preprocess_upload.py 98.14% <100.00%> (ø)
tasks/upload.py 96.19% <100.00%> (ø)
services/report/__init__.py 96.31% <91.30%> (-1.08%) ⬇️

... and 2 files with indirect coverage changes

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 97.75281% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.98%. Comparing base (3cdf975) to head (67e5adc).
Report is 1 commits behind head on main.

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/report/__init__.py Critical 91.30% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #660      +/-   ##
==========================================
- Coverage   98.11%   97.98%   -0.13%     
==========================================
  Files         476      476              
  Lines       38213    38185      -28     
==========================================
- Hits        37492    37417      -75     
- Misses        721      768      +47     
Flag Coverage Δ
integration 97.93% <97.75%> (-0.13%) ⬇️
latest-uploader-overall 97.93% <97.75%> (-0.13%) ⬇️
unit 97.93% <97.75%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 95.74% <92.59%> (-0.31%) ⬇️
OutsideTasks 98.03% <97.70%> (-0.03%) ⬇️
Files with missing lines Coverage Δ
services/bundle_analysis/report.py 100.00% <100.00%> (ø)
services/notification/notifiers/tests/conftest.py 100.00% <100.00%> (ø)
services/test_results.py 90.10% <100.00%> (ø)
services/tests/test_report.py 100.00% <100.00%> (ø)
tasks/preprocess_upload.py 98.18% <100.00%> (ø)
tasks/upload.py Critical 97.59% <100.00%> (ø)
services/report/__init__.py Critical 96.32% <91.30%> (-1.08%) ⬇️

... and 2 files with indirect coverage changes

Related Entrypoints
run/app.tasks.upload.Upload
run/app.tasks.notify.Notify
run/app.tasks.timeseries.save_commit_measurements
run/app.tasks.pulls.Sync
run/app.tasks.compute_comparison.ComputeComparison
run/app.tasks.upload.UploadFinisher
run/app.tasks.upload.UploadProcessor
run/app.tasks.upload.PreProcessUpload
run/app.tasks.label_analysis.process_request

@Swatinem Swatinem changed the title Make ReportService.initialize_and_save_report sync Make ReportService sync Aug 29, 2024
@Swatinem Swatinem force-pushed the swatinem/sync-initreport branch from d8b1b1d to 18985e0 Compare August 29, 2024 15:39
Copy link
Contributor

@matt-codecov matt-codecov left a comment

Choose a reason for hiding this comment

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

nice, thank you for the cleanup! you are right that sync is preferred. i got rid of a lot of the asyncs in #304 in a semi-automated fashion but didn't get em all

everything used to be labeled async, but the django ORM (which we have begun slowly converging on, away from sqlalchemy) hates that and as you observed all our work is synchronous so we never had anything to yield to

It looks like historically there is a mix of sync/async code.
The consensus(?) seems to favor sync code as celery is fundamentally sync.
Async code also does not play as well with profiling, which will not show the async code directly in a flamegraph, instead just inserting a `wait` for the async code running in a different thread.
@Swatinem Swatinem force-pushed the swatinem/sync-initreport branch from 18985e0 to 67e5adc Compare August 30, 2024 08:36
@Swatinem Swatinem added this pull request to the merge queue Aug 30, 2024
Merged via the queue into main with commit 26de857 Aug 30, 2024
13 of 26 checks passed
@Swatinem Swatinem deleted the swatinem/sync-initreport branch August 30, 2024 09:18
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