зеркало из https://github.com/mozilla/treeherder.git
Revert "Bug 1919588 - Add a new testing alert table, along with new fields. (#8200)" for uniqueness failure
This reverts commit fb59b00868
.
This commit is contained in:
Родитель
34fb5344e4
Коммит
2f33cc4d79
|
@ -101,9 +101,9 @@ def test_reassigning_regression(
|
||||||
|
|
||||||
assert s.status == PerformanceAlertSummary.UNTRIAGED
|
assert s.status == PerformanceAlertSummary.UNTRIAGED
|
||||||
|
|
||||||
# reassigning a regression that was in the first summary
|
# reassigning a regression to the initial summary
|
||||||
# to the second summary should leave the status as UNTRIAGED
|
# which contains only an improvement
|
||||||
reassigned_alert = create_perf_alert(
|
create_perf_alert(
|
||||||
summary=s,
|
summary=s,
|
||||||
series_signature=signature1,
|
series_signature=signature1,
|
||||||
related_summary=test_perf_alert_summary_2,
|
related_summary=test_perf_alert_summary_2,
|
||||||
|
@ -117,12 +117,9 @@ def test_reassigning_regression(
|
||||||
# the regression alert will keep it's status of REASSIGNED
|
# the regression alert will keep it's status of REASSIGNED
|
||||||
untriaged_improvement_alert.status = PerformanceAlert.ACKNOWLEDGED
|
untriaged_improvement_alert.status = PerformanceAlert.ACKNOWLEDGED
|
||||||
untriaged_improvement_alert.save()
|
untriaged_improvement_alert.save()
|
||||||
assert reassigned_alert.status == PerformanceAlert.REASSIGNED
|
|
||||||
|
|
||||||
# Status of the summary with only improvements should automatically
|
|
||||||
# have a status of IMPROVEMENT
|
|
||||||
s = PerformanceAlertSummary.objects.get(id=1)
|
s = PerformanceAlertSummary.objects.get(id=1)
|
||||||
assert s.status == PerformanceAlertSummary.IMPROVEMENT
|
assert s.status == PerformanceAlertSummary.INVESTIGATING
|
||||||
|
|
||||||
|
|
||||||
def test_improvement_summary_status_after_reassigning_regression(
|
def test_improvement_summary_status_after_reassigning_regression(
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Generated by Django 5.1.2 on 2024-10-16 18:38
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("perf", "0054_performancealert_confidence_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="performancealerttesting",
|
||||||
|
name="related_summary",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="performancealerttesting",
|
||||||
|
name="summary",
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name="performancealerttesting",
|
||||||
|
unique_together=None,
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="performancealerttesting",
|
||||||
|
name="classifier",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="performancealerttesting",
|
||||||
|
name="series_signature",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="performancealert",
|
||||||
|
name="confidence",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="performancealert",
|
||||||
|
name="detection_method",
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name="PerformanceAlertSummaryTesting",
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name="PerformanceAlertTesting",
|
||||||
|
),
|
||||||
|
]
|
|
@ -256,7 +256,7 @@ class IssueTracker(models.Model):
|
||||||
return f"{self.name} (tasks via {self.task_base_url})"
|
return f"{self.name} (tasks via {self.task_base_url})"
|
||||||
|
|
||||||
|
|
||||||
class PerformanceAlertSummaryBase(models.Model):
|
class PerformanceAlertSummary(models.Model):
|
||||||
"""
|
"""
|
||||||
A summarization of performance alerts
|
A summarization of performance alerts
|
||||||
|
|
||||||
|
@ -351,64 +351,61 @@ class PerformanceAlertSummaryBase(models.Model):
|
||||||
self.status = self.autodetermine_status()
|
self.status = self.autodetermine_status()
|
||||||
self.save(using=using)
|
self.save(using=using)
|
||||||
|
|
||||||
def autodetermine_status(self, alert_model=None):
|
def autodetermine_status(self):
|
||||||
summary_class = self.__class__
|
alerts = PerformanceAlert.objects.filter(summary=self) | PerformanceAlert.objects.filter(
|
||||||
if not alert_model:
|
|
||||||
alert_model = PerformanceAlert
|
|
||||||
|
|
||||||
alerts = alert_model.objects.filter(summary=self) | alert_model.objects.filter(
|
|
||||||
related_summary=self
|
related_summary=self
|
||||||
)
|
)
|
||||||
|
|
||||||
# if no alerts yet, we'll say untriaged
|
# if no alerts yet, we'll say untriaged
|
||||||
if not alerts:
|
if not alerts:
|
||||||
return summary_class.UNTRIAGED
|
return PerformanceAlertSummary.UNTRIAGED
|
||||||
|
|
||||||
# if any untriaged, then set to untriaged
|
# if any untriaged, then set to untriaged
|
||||||
if any(alert.status == alert_model.UNTRIAGED for alert in alerts):
|
if any(alert.status == PerformanceAlert.UNTRIAGED for alert in alerts):
|
||||||
return summary_class.UNTRIAGED
|
return PerformanceAlertSummary.UNTRIAGED
|
||||||
|
|
||||||
# if the summary's status is IMPROVEMENT, but a regression is
|
# if the summary's status is IMPROVEMENT, but a regression is
|
||||||
# reassigned to that summary then set the summary's status to untriaged
|
# reassigned to that summary then set the summary's status to untriaged
|
||||||
# and change all acknowledged statuses to untriaged
|
# and change all acknowledged statuses to untriaged
|
||||||
if self.status == summary_class.IMPROVEMENT:
|
if self.status == PerformanceAlertSummary.IMPROVEMENT:
|
||||||
if any(
|
if any(
|
||||||
alert.status == alert_model.REASSIGNED and alert.is_regression for alert in alerts
|
alert.status == PerformanceAlert.REASSIGNED and alert.is_regression
|
||||||
|
for alert in alerts
|
||||||
):
|
):
|
||||||
acknowledged_alerts = [
|
acknowledged_alerts = [
|
||||||
alert for alert in alerts if alert.status == alert_model.ACKNOWLEDGED
|
alert for alert in alerts if alert.status == PerformanceAlert.ACKNOWLEDGED
|
||||||
]
|
]
|
||||||
for alert in acknowledged_alerts:
|
for alert in acknowledged_alerts:
|
||||||
alert.status = alert_model.UNTRIAGED
|
alert.status = PerformanceAlert.UNTRIAGED
|
||||||
alert.save()
|
alert.save()
|
||||||
return summary_class.UNTRIAGED
|
return PerformanceAlertSummary.UNTRIAGED
|
||||||
|
|
||||||
# if all invalid, then set to invalid
|
# if all invalid, then set to invalid
|
||||||
if all(alert.status == alert_model.INVALID for alert in alerts):
|
if all(alert.status == PerformanceAlert.INVALID for alert in alerts):
|
||||||
return summary_class.INVALID
|
return PerformanceAlertSummary.INVALID
|
||||||
|
|
||||||
# otherwise filter out invalid alerts
|
# otherwise filter out invalid alerts
|
||||||
alerts = [a for a in alerts if a.status != alert_model.INVALID]
|
alerts = [a for a in alerts if a.status != PerformanceAlert.INVALID]
|
||||||
|
|
||||||
# if there are any "acknowledged" alerts, then set to investigating
|
# if there are any "acknowledged" alerts, then set to investigating
|
||||||
# if not one of the resolved statuses and there are regressions,
|
# if not one of the resolved statuses and there are regressions,
|
||||||
# otherwise we'll say it's an improvement
|
# otherwise we'll say it's an improvement
|
||||||
if any(alert.status == alert_model.ACKNOWLEDGED for alert in alerts):
|
if any(alert.status == PerformanceAlert.ACKNOWLEDGED for alert in alerts):
|
||||||
if all(
|
if all(
|
||||||
not alert.is_regression
|
not alert.is_regression
|
||||||
for alert in alerts
|
for alert in alerts
|
||||||
if alert.status == alert_model.ACKNOWLEDGED
|
if alert.status == PerformanceAlert.ACKNOWLEDGED
|
||||||
or (alert.status == alert_model.REASSIGNED and alert.related_summary.id == self.id)
|
or alert.status == PerformanceAlert.REASSIGNED
|
||||||
):
|
):
|
||||||
return summary_class.IMPROVEMENT
|
return PerformanceAlertSummary.IMPROVEMENT
|
||||||
elif self.status not in (
|
elif self.status not in (
|
||||||
summary_class.IMPROVEMENT,
|
PerformanceAlertSummary.IMPROVEMENT,
|
||||||
summary_class.INVESTIGATING,
|
PerformanceAlertSummary.INVESTIGATING,
|
||||||
summary_class.WONTFIX,
|
PerformanceAlertSummary.WONTFIX,
|
||||||
summary_class.FIXED,
|
PerformanceAlertSummary.FIXED,
|
||||||
summary_class.BACKED_OUT,
|
PerformanceAlertSummary.BACKED_OUT,
|
||||||
):
|
):
|
||||||
return summary_class.INVESTIGATING
|
return PerformanceAlertSummary.INVESTIGATING
|
||||||
# keep status if one of the investigating ones
|
# keep status if one of the investigating ones
|
||||||
return self.status
|
return self.status
|
||||||
|
|
||||||
|
@ -416,10 +413,10 @@ class PerformanceAlertSummaryBase(models.Model):
|
||||||
# alerts of its own: all alerts should be either reassigned,
|
# alerts of its own: all alerts should be either reassigned,
|
||||||
# downstream, or invalid (but not all invalid, that case is covered
|
# downstream, or invalid (but not all invalid, that case is covered
|
||||||
# above)
|
# above)
|
||||||
if any(alert.status == alert_model.REASSIGNED for alert in alerts):
|
if any(alert.status == PerformanceAlert.REASSIGNED for alert in alerts):
|
||||||
return summary_class.REASSIGNED
|
return PerformanceAlertSummary.REASSIGNED
|
||||||
|
|
||||||
return summary_class.DOWNSTREAM
|
return PerformanceAlertSummary.DOWNSTREAM
|
||||||
|
|
||||||
def timestamp_first_triage(self):
|
def timestamp_first_triage(self):
|
||||||
# called for summary specific updates (e.g. notes, bug linking)
|
# called for summary specific updates (e.g. notes, bug linking)
|
||||||
|
@ -428,32 +425,14 @@ class PerformanceAlertSummaryBase(models.Model):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
db_table = "performance_alert_summary"
|
||||||
|
unique_together = ("repository", "framework", "prev_push", "push")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.framework} {self.repository} {self.prev_push.revision}-{self.push.revision}"
|
return f"{self.framework} {self.repository} {self.prev_push.revision}-{self.push.revision}"
|
||||||
|
|
||||||
|
|
||||||
class PerformanceAlertSummary(PerformanceAlertSummaryBase):
|
class PerformanceAlert(models.Model):
|
||||||
class Meta:
|
|
||||||
db_table = "performance_alert_summary"
|
|
||||||
unique_together = ("repository", "framework", "prev_push", "push")
|
|
||||||
|
|
||||||
|
|
||||||
class PerformanceAlertSummaryTesting(PerformanceAlertSummaryBase):
|
|
||||||
assignee = models.ForeignKey(
|
|
||||||
User, on_delete=models.SET_NULL, null=True, related_name="assigned_alerts_testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
def autodetermine_status(self, alert_model=None):
|
|
||||||
super().autodetermine_status(alert_model=PerformanceAlertTesting)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = "performance_alert_summary_testing"
|
|
||||||
unique_together = ("repository", "framework", "prev_push", "push")
|
|
||||||
|
|
||||||
|
|
||||||
class PerformanceAlertBase(models.Model):
|
|
||||||
"""
|
"""
|
||||||
A single performance alert
|
A single performance alert
|
||||||
|
|
||||||
|
@ -517,15 +496,6 @@ class PerformanceAlertBase(models.Model):
|
||||||
null=True,
|
null=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
confidence = models.FloatField(
|
|
||||||
help_text=(
|
|
||||||
"A value that indicates the confidence of the alert (specific to "
|
|
||||||
"the detection method used)"
|
|
||||||
),
|
|
||||||
null=True,
|
|
||||||
)
|
|
||||||
detection_method = models.CharField(max_length=100, null=True)
|
|
||||||
|
|
||||||
SKEWED = "SKEWED"
|
SKEWED = "SKEWED"
|
||||||
OUTLIERS = "OUTLIERS"
|
OUTLIERS = "OUTLIERS"
|
||||||
MODAL = "MODAL"
|
MODAL = "MODAL"
|
||||||
|
@ -616,33 +586,12 @@ class PerformanceAlertBase(models.Model):
|
||||||
self.summary.timestamp_first_triage().save()
|
self.summary.timestamp_first_triage().save()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
class Meta:
|
|
||||||
abstract = True
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.summary} {self.series_signature} {self.amount_pct}%"
|
|
||||||
|
|
||||||
|
|
||||||
class PerformanceAlert(PerformanceAlertBase):
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = "performance_alert"
|
db_table = "performance_alert"
|
||||||
unique_together = ("summary", "series_signature")
|
unique_together = ("summary", "series_signature")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
class PerformanceAlertTesting(PerformanceAlertBase):
|
return f"{self.summary} {self.series_signature} {self.amount_pct}%"
|
||||||
summary = models.ForeignKey(
|
|
||||||
PerformanceAlertSummaryTesting, on_delete=models.CASCADE, related_name="alerts"
|
|
||||||
)
|
|
||||||
related_summary = models.ForeignKey(
|
|
||||||
PerformanceAlertSummaryTesting,
|
|
||||||
on_delete=models.CASCADE,
|
|
||||||
related_name="related_alerts",
|
|
||||||
null=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
db_table = "performance_alert_testing"
|
|
||||||
unique_together = ("summary", "series_signature")
|
|
||||||
|
|
||||||
|
|
||||||
class PerformanceTag(models.Model):
|
class PerformanceTag(models.Model):
|
||||||
|
|
Загрузка…
Ссылка в новой задаче