-
Notifications
You must be signed in to change notification settings - Fork 361
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 new_failure field to TextLogError and update when we have a… #8254
Merged
+46
−1
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,9 @@ def store_text_log_summary_artifact(job, text_log_summary_artifact): | |
ignore_conflicts=True, | ||
) | ||
|
||
# Bulk create doesn't return .id field, so query to get them. | ||
log_errors = TextLogError.objects.filter(job=job) | ||
|
||
# get error summary immediately (to warm the cache) | ||
# Conflicts may have occured during the insert, but we pass the queryset for performance | ||
bugs = error_summary.get_error_summary(job, queryset=log_errors) | ||
|
@@ -42,7 +45,13 @@ def store_text_log_summary_artifact(job, text_log_summary_artifact): | |
]: | ||
# classify job as `new failure` - for filtering, etc. | ||
job.failure_classification_id = 6 | ||
job.save() | ||
job.save(update_fields=["failure_classification_id"]) | ||
# for every log_errors (TLE object) there is a corresponding bugs/suggestion | ||
for tle in log_errors: | ||
if tle.line_number == suggestion["line_number"]: | ||
tle.new_failure = True | ||
tle.save(update_fields=["new_failure"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using update_fields is a perf win, so I get a little bit of a win here for the existing code :) |
||
break | ||
|
||
|
||
def store_job_artifacts(artifact_data): | ||
|
21 changes: 21 additions & 0 deletions
21
treeherder/model/migrations/0033_textlogerror_new_failure.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 4.2.13 on 2024-10-21 13:53 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
( | ||
"model", | ||
"0032_rename_failureline_job_guid_repository_failure_lin_job_gui_b67c6d_idx_and_more", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="textlogerror", | ||
name="new_failure", | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note, this could be a perf impact, we could reconsider this specific approach, maybe only do this if we have a need to update, or convert bulk_create -> save() in a loop