Skip to content

Commit

Permalink
fix upload task passing args/kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Aug 17, 2023
1 parent 305e9e8 commit e9125e7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tasks/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
CHUNK_SIZE = 3


def _prepare_kwargs_for_retry(repoid, commitid, report_code, kwargs):
kwargs.update(
{
"repoid": repoid,
"commitid": commitid,
"report_code": report_code,
}
)


class UploadTask(BaseCodecovTask):
"""The first of a series of tasks designed to process an `upload` made by the user
Expand Down Expand Up @@ -166,7 +176,8 @@ async def run_async(
),
),
)
self.retry(countdown=60, args=args, kwargs=kwargs)
_prepare_kwargs_for_retry(repoid, commitid, report_code, kwargs)
self.retry(countdown=60, kwargs=kwargs)
try:
with redis_connection.lock(
lock_name,
Expand Down Expand Up @@ -216,9 +227,8 @@ async def run_async(
commit=commitid, repoid=repoid, countdown=int(retry_countdown)
),
)
self.retry(
max_retries=3, countdown=retry_countdown, args=args, kwargs=kwargs
)
_prepare_kwargs_for_retry(repoid, commitid, report_code, kwargs)
self.retry(max_retries=3, countdown=retry_countdown, kwargs=kwargs)

async def run_async_within_lock(
self,
Expand Down Expand Up @@ -265,7 +275,8 @@ async def run_async_within_lock(
repoid=repoid, commit=commitid, countdown=retry_countdown
),
)
self.retry(countdown=retry_countdown, args=args, kwargs=kwargs)
_prepare_kwargs_for_retry(repoid, commitid, report_code, kwargs)
self.retry(countdown=retry_countdown, kwargs=kwargs)

try:
checkpoints = checkpoints_from_kwargs(UploadFlow, kwargs)
Expand Down Expand Up @@ -343,7 +354,8 @@ async def run_async_within_lock(
"Commit not yet ready to build its initial report. Retrying in 60s.",
extra=dict(repoid=commit.repoid, commit=commit.commitid),
)
self.retry(countdown=60, args=args, kwargs=kwargs)
_prepare_kwargs_for_retry(repoid, commitid, report_code, kwargs)
self.retry(countdown=60, kwargs=kwargs)
argument_list = []
for arguments in self.lists_of_arguments(redis_connection, repoid, commitid):
normalized_arguments = self.normalize_upload_arguments(
Expand Down

0 comments on commit e9125e7

Please sign in to comment.