Skip to content

Commit

Permalink
fix: empty reports not being saved in readable format (#561)
Browse files Browse the repository at this point in the history
giovanni-guidini authored Jul 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d4ce3af commit 555a769
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions services/report/__init__.py
Original file line number Diff line number Diff line change
@@ -88,6 +88,8 @@ def as_dict(self):
"error": self.error.as_dict(),
"report": self.report,
"should_retry": False,
"raw_report": self.raw_report,
"upload_obj": self.upload_obj,
}
return {
"successful": True,
2 changes: 2 additions & 0 deletions tasks/tests/unit/test_upload_processing_task.py
Original file line number Diff line number Diff line change
@@ -737,6 +737,8 @@ def test_upload_task_process_individual_report_with_notfound_report(
"report": None,
"should_retry": False,
"successful": False,
"raw_report": None,
"upload_obj": upload,
}
assert expected_result == result
assert commit.state == "complete"
5 changes: 4 additions & 1 deletion tasks/upload_processor.py
Original file line number Diff line number Diff line change
@@ -207,6 +207,7 @@ def process_impl_within_lock(

processings_so_far = previous_results.get("processings_so_far", [])
n_processed = 0
n_failed = 0

commit_yaml = UserYaml(commit_yaml)
commit = None
@@ -301,6 +302,8 @@ def process_impl_within_lock(
if individual_info.get("successful"):
report = individual_info.pop("report")
n_processed += 1
else:
n_failed += 1
processings_so_far.append(individual_info)
log.info(
f"Finishing the processing of {n_processed} reports"
@@ -379,7 +382,7 @@ def process_impl_within_lock(
processed_individual_report.pop("upload_obj", None)
processed_individual_report.pop("raw_report", None)
log.info(
f"Processed {n_processed} reports"
f"Processed {n_processed} reports (+ {n_failed} failed)"
+ (" (in parallel)" if in_parallel else ""),
extra=dict(
repoid=repoid,

0 comments on commit 555a769

Please sign in to comment.