chore(): minor fixes around codebase
This commit is contained in:
@@ -28,11 +28,6 @@ from apps.notifications.services import (
|
||||
)
|
||||
from apps.reports.services import calculate_metric_value
|
||||
|
||||
_ACTION_SEVERITY = {
|
||||
GuardrailAction.ROLLBACK: 0,
|
||||
GuardrailAction.PAUSE: 1,
|
||||
}
|
||||
|
||||
|
||||
@transaction.atomic
|
||||
def guardrail_create(
|
||||
@@ -69,6 +64,7 @@ def guardrail_update(
|
||||
guardrail: Guardrail,
|
||||
**fields: Any,
|
||||
) -> Guardrail:
|
||||
guardrail.experiment.refresh_from_db(fields=["status"])
|
||||
if guardrail.experiment.status in STARTED_STATUSES:
|
||||
raise ValidationError(
|
||||
{
|
||||
@@ -96,6 +92,7 @@ def guardrail_update(
|
||||
|
||||
|
||||
def guardrail_delete(*, guardrail: Guardrail) -> None:
|
||||
guardrail.experiment.refresh_from_db(fields=["status"])
|
||||
if guardrail.experiment.status in STARTED_STATUSES:
|
||||
raise ValidationError(
|
||||
{
|
||||
@@ -171,7 +168,7 @@ def _execute_guardrail_action(
|
||||
guardrail: Guardrail,
|
||||
experiment: Experiment,
|
||||
actual_value: Decimal,
|
||||
) -> GuardrailTrigger:
|
||||
) -> GuardrailTrigger | None:
|
||||
now = timezone.now()
|
||||
|
||||
experiment = Experiment.objects.select_for_update().get(pk=experiment.pk)
|
||||
|
||||
Reference in New Issue
Block a user