Exemplo n.º 1
0
    def update_status(self, *args, **kwargs):
        res = super().update_status(*args, **kwargs)

        if self.status == self.FAILURE:
            send_failed_evaluation_email(self)

        if self.status == self.SUCCESS:
            send_successful_evaluation_email(self)

        return res
Exemplo n.º 2
0
    def create_result(self, *, result: dict):
        interface = ComponentInterface.objects.get(slug="metrics-json-file")

        try:
            output_civ = self.outputs.get(interface=interface)
            output_civ.value = result
            output_civ.save()
        except ObjectDoesNotExist:
            output_civ = ComponentInterfaceValue.objects.create(
                interface=interface, value=result)
            self.outputs.add(output_civ)
            send_successful_evaluation_email(self)