def process()

in treeherder/etl/classification_loader.py [0:0]


    def process(self, pulse_job, root_url):
        task_id = pulse_job["status"]["taskId"]

        task_definition = get_task_definition(root_url, task_id)
        assert "routes" in task_definition and len(task_definition["routes"]) > 0, (
            "A route containing the push project and revision is needed to save the mozci classification"
        )
        # Retrieving a Push object thanks to the project/revision parsed from the task first route
        try:
            push = self.get_push(task_definition["routes"][0])
        except Repository.DoesNotExist:
            return
        except (AttributeError, Push.DoesNotExist):
            logger.error(
                "Failed to retrieve the Push that was classified by mozci during task %s", task_id
            )
            # Raising the exception to retry the Celery task as much as possible
            raise

        # Downloading the artifact containing the classification generated by mozci for this push
        classification_json = download_artifact(root_url, task_id, "public/classification.json")

        # Saving the mozci classification in the database
        results = dict(MozciClassification.CLASSIFICATION_RESULT)
        classification = classification_json["push"]["classification"]
        assert classification in results.keys(), (
            "Classification result should be a value in BAD, GOOD, UNKNOWN"
        )

        logger.info(
            "Storing mozci classification calculated as %s for push %s on repository %s",
            classification,
            push.revision,
            push.repository.name,
        )
        MozciClassification.objects.create(
            push=push,
            result=classification,
            task_id=task_id,
        )

        try:
            autoclassified_intermittent = FailureClassification.objects.get(
                name="autoclassified intermittent"
            )
        except FailureClassification.DoesNotExist:
            logger.error(
                "FailureClassification named 'autoclassified intermittent' does not exist."
            )
            raise

        # Autoclassifying intermittent failures when the "autoclassify" flag is activated on them
        self.autoclassify_failures(
            classification_json["failures"]["intermittent"], autoclassified_intermittent
        )