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

adding log #139

Merged
merged 4 commits into from
Oct 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions tasks/upload_finisher.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
import re
from copy import deepcopy

import sentry_sdk
from redis.exceptions import LockError
from shared.celery_config import (
compute_comparison_task_name,
notify_task_name,
Expand Down Expand Up @@ -79,22 +78,40 @@
commit = commits.first()
assert commit, "Commit not found in database."
redis_connection = get_redis_connection()
with redis_connection.lock(lock_name, timeout=60 * 5, blocking_timeout=5):
commit_yaml = UserYaml(commit_yaml)
db_session.commit()
commit.notified = False
db_session.commit()
result = await self.finish_reports_processing(
db_session,
commit,
commit_yaml,
processing_results,
report_code,
checkpoints,
try:
with redis_connection.lock(lock_name, timeout=60 * 5, blocking_timeout=5):
commit_yaml = UserYaml(commit_yaml)
db_session.commit()
commit.notified = False
db_session.commit()
result = await self.finish_reports_processing(
db_session,
commit,
commit_yaml,
processing_results,
report_code,
checkpoints,
)
save_commit_measurements(commit)
self.invalidate_caches(redis_connection, commit)
log.info(
"Finished upload_finisher task",
extra=dict(
repoid=repoid,
commit=commitid,
parent_task=self.request.parent_id,
),
)
return result
except LockError:
log.warning(

Check warning on line 107 in tasks/upload_finisher.py

View check run for this annotation

Codecov / codecov/patch

tasks/upload_finisher.py#L106-L107

Added lines #L106 - L107 were not covered by tests

Check warning on line 107 in tasks/upload_finisher.py

View check run for this annotation

Codecov Public QA / codecov/patch

tasks/upload_finisher.py#L106-L107

Added lines #L106 - L107 were not covered by tests

Check warning on line 107 in tasks/upload_finisher.py

View check run for this annotation

Codecov - QA / codecov/patch

tasks/upload_finisher.py#L106-L107

Added lines #L106 - L107 were not covered by tests
"Unable to acquire lock for key %s. Retrying",
dana-yaish marked this conversation as resolved.
Show resolved Hide resolved
lock_name,
extra=dict(
commit=commitid,
repoid=repoid,
),
)
save_commit_measurements(commit)
self.invalidate_caches(redis_connection, commit)
return result

async def finish_reports_processing(
self,
Expand Down
Loading