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

add get_repo_provider_service fn to base task #1107

Merged
merged 1 commit into from
Feb 26, 2025
Merged

add get_repo_provider_service fn to base task #1107

merged 1 commit into from
Feb 26, 2025

Conversation

matt-codecov
Copy link
Contributor

@matt-codecov matt-codecov commented Feb 25, 2025

get_repo_provider_service() can raise two exceptions which we do not consistently catch. from a quick scan of usages, it appears to make sense to handle them the same way across tasks, so this PR adds a wrapper method to BaseCodecovTask that behaves as follows:

  • calls get_repo_provider_service()
  • if RepositoryWithoutValidBotError, call save_commit_error() and return None. each task can decide whether it can proceed without a repo_provider or not
  • if NoConfiguredAppsAvailable, there are two ways to handle it:
    • if exc.rate_limited_count > 0, retry the task at the start of the next hour
    • otherwise, return None and each task can decide whether it can proceed without a repo_provider or not

i created codecov/engineering-team#3389 to keep track of moving usages of get_repo_provider_service() to this new method since there are many usages to move and some of them may prove to be non-trivial

@matt-codecov matt-codecov force-pushed the pr1107 branch 2 times, most recently from 83084f5 to 61a4253 Compare February 25, 2025 22:23
Copy link
Contributor

@adrian-codecov adrian-codecov left a comment

Choose a reason for hiding this comment

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

In principle this looks good to me. I also think this should apply to get_owner_provider_service as it also calls the same fn. I believe Gio worked on this fn a while back so might be worth getting his opinion too

@matt-codecov matt-codecov force-pushed the pr1107 branch 4 times, most recently from c41ea20 to 160cc32 Compare February 25, 2025 23:28
@matt-codecov
Copy link
Contributor Author

I also think this should apply to get_owner_provider_service as it also calls the same fn

we can burn that bridge when we come to it haha

@matt-codecov matt-codecov marked this pull request as ready for review February 25, 2025 23:34
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

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

Project coverage is 97.25%. Comparing base (74b3287) to head (94089b8).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/base.py 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1107      +/-   ##
==========================================
- Coverage   97.25%   97.25%   -0.01%     
==========================================
  Files         454      454              
  Lines       37335    37392      +57     
==========================================
+ Hits        36310    36365      +55     
- Misses       1025     1027       +2     
Flag Coverage Δ
integration 43.09% <31.14%> (-0.03%) ⬇️
unit 89.80% <96.72%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

codecov-notifications bot commented Feb 25, 2025

Codecov Report

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

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
tasks/base.py 92.30% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@matt-codecov matt-codecov added this pull request to the merge queue Feb 26, 2025
Merged via the queue into main with commit afc0de3 Feb 26, 2025
26 of 29 checks passed
@matt-codecov matt-codecov deleted the pr1107 branch February 26, 2025 21:29
countdown_seconds=retry_delay_seconds,
),
)
self._retry(countdown=retry_delay_seconds)
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m not a big fan of putting more methods onto the "celery task", but instead move more code out of the "celery as task scheduling framework".

I think the only reason for this to be tied to "celery as a framework" is converting the exception to a retry.

Copy link

sentry-io bot commented Feb 27, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ InvalidInstallationError: permission_error app.tasks.upload.Upload View Issue
  • ‼️ ConnectTimeout: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /app/installations/42539916/access_tokens (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f6b55692850>, 'Connection to api.github.com ti... app.tasks.upload.Upload View Issue

Did you find this useful? React with a 👍 or 👎

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.

4 participants