Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit a96d25e

Browse files
fix: pass impl_type arg to TA tasks instead of new_impl (#1122)
1 parent 13b3095 commit a96d25e

2 files changed

Lines changed: 11 additions & 41 deletions

File tree

tasks/tests/unit/test_upload_task.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,14 @@ def test_upload_task_call_test_results(
424424
}
425425
],
426426
report_code=None,
427+
impl_type="old",
427428
)
428429
kwargs = dict(
429430
repoid=commit.repoid,
430431
commitid=commit.commitid,
431432
commit_yaml={"codecov": {"max_report_age": "1y ago"}},
432433
checkpoints_TestResultsFlow=None,
434+
impl_type="old",
433435
)
434436

435437
kwargs[_kwargs_key(TestResultsFlow)] = mocker.ANY
@@ -448,7 +450,7 @@ def test_upload_task_call_new_ta_tasks(
448450
celery_app,
449451
):
450452
chain = mocker.patch("tasks.upload.chain")
451-
_ = mocker.patch("tasks.upload.NEW_TA_TASKS.check_value", return_value=True)
453+
_ = mocker.patch("tasks.upload.NEW_TA_TASKS.check_value", return_value="both")
452454
storage_path = "v4/raw/2019-05-22/C3C4715CA57C910D11D5EB899FC86A7E/4c4e4654ac25037ae869caeb3619d485970b6304/a84d445c-9c1e-434f-8275-f18f1f320f81.txt"
453455
redis_queue = [{"url": storage_path, "build_code": "some_random_build"}]
454456
jsonified_redis_queue = [json.dumps(x) for x in redis_queue]
@@ -533,37 +535,19 @@ def test_upload_task_call_new_ta_tasks(
533535
}
534536
],
535537
report_code=None,
538+
impl_type="both",
536539
)
537540
kwargs = dict(
538541
repoid=commit.repoid,
539542
commitid=commit.commitid,
540543
commit_yaml={"codecov": {"max_report_age": "1y ago"}},
541544
checkpoints_TestResultsFlow=None,
542-
)
543-
544-
new_task = test_results_processor_task.s(
545-
False,
546-
repoid=commit.repoid,
547-
commitid=commit.commitid,
548-
commit_yaml={"codecov": {"max_report_age": "1y ago"}},
549-
arguments_list=[
550-
{
551-
"url": storage_path,
552-
"flags": [],
553-
"build_code": "some_random_build",
554-
"upload_id": upload.id,
555-
"upload_pk": upload.id,
556-
}
557-
],
558-
report_code=None,
559-
new_impl=True,
545+
impl_type="both",
560546
)
561547

562548
kwargs[_kwargs_key(TestResultsFlow)] = mocker.ANY
563549
notify_sig = test_results_finisher_task.signature(kwargs=kwargs)
564-
chain.assert_has_calls(
565-
[call(processor_sig, notify_sig), call(new_task)], any_order=True
566-
)
550+
chain.assert_has_calls([call(processor_sig, notify_sig)], any_order=True)
567551

568552
def test_upload_task_call_no_jobs(
569553
self,

tasks/upload.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -771,13 +771,15 @@ def _schedule_ta_processing_task(
771771
argument_list: list[UploadArguments],
772772
commit_report: CommitReport,
773773
):
774+
new_ta_tasks = NEW_TA_TASKS.check_value(commit.repoid, default="old")
774775
task_group = [
775776
test_results_processor_task.s(
776777
repoid=commit.repoid,
777778
commitid=commit.commitid,
778779
commit_yaml=commit_yaml,
779780
arguments_list=list(chunk),
780781
report_code=commit_report.code,
782+
impl_type=new_ta_tasks,
781783
)
782784
for chunk in itertools.batched(argument_list, CHUNK_SIZE)
783785
]
@@ -788,31 +790,15 @@ def _schedule_ta_processing_task(
788790
"repoid": commit.repoid,
789791
"commitid": commit.commitid,
790792
"commit_yaml": commit_yaml,
793+
"impl_type": new_ta_tasks,
791794
}
792795
finisher_kwargs = TestResultsFlow.save_to_kwargs(finisher_kwargs)
793796
task_group.append(
794797
test_results_finisher_task.signature(kwargs=finisher_kwargs),
795798
)
796-
first_chain_result = chain(*task_group).apply_async()
799+
chain_result = chain(*task_group).apply_async()
797800

798-
if NEW_TA_TASKS.check_value(commit.repoid):
799-
new_task_group = [
800-
test_results_processor_task.s(
801-
repoid=commit.repoid,
802-
commitid=commit.commitid,
803-
commit_yaml=commit_yaml,
804-
arguments_list=list(chunk),
805-
report_code=commit_report.code,
806-
new_impl=True,
807-
)
808-
for chunk in itertools.batched(argument_list, CHUNK_SIZE)
809-
]
810-
811-
new_task_group[0].args = (False,)
812-
813-
_ = chain(*new_task_group).apply_async()
814-
815-
return first_chain_result
801+
return chain_result
816802

817803
def possibly_carryforward_bundle_report(
818804
self,

0 commit comments

Comments
 (0)