

def process(self, severity, message_template, scope, alert_type='undefined', alert_context=None, fail_silently=True):
    self.validate_logging_type(alert_type)
    if (not alert_context):
        alert_context = {
            
        }
    context = self.compile_context(**alert_context)
    msg = self.compile_message(message_template, context)
    content_type = ct_models.ContentType.objects.get_for_model(scope)
    try:
        with transaction.atomic():
            alert = models.Alert.objects.select_for_update().get(content_type=content_type, object_id=scope.id, alert_type=alert_type, closed__isnull=True)
            if ((alert.severity != severity) or (alert.message != msg)):
                alert.severity = severity
                alert.message = msg
                alert.save()
                logger.info('Updated alert for scope %s (id: %s), with type %s', scope, scope.id, alert_type)
            return (alert, False)
    except models.Alert.DoesNotExist:
        pass
    try:
        alert = models.Alert.objects.create(scope=scope, alert_type=alert_context, severity=severity, message=msg, context=context)
        logger.info('Created new alert for scope %s (id: %s), with type %s', scope, scope.id, alert_type)
        return (alert, True)
    except IntegrityError:
        logger.warning('Could not create alert for scope %s (id: %s), with type %s due to concurrent update', scope, scope.id, alert_type)
        if fail_silently:
            return (None, False)
        else:
            raise

dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/logging/loggers.py AlertLogger.process/VarMisuse@227/315 `alert_type`->`alert_context`