def load_artifacts()

in bot/code_review_bot/tasks/tgdiff.py [0:0]


    def load_artifacts(self, queue_service):
        # Process only the supported final states
        # as some tasks do not always have relevant output
        if self.state in self.skipped_states:
            logger.info("Skipping task", state=self.state, id=self.id, name=self.name)
            return
        elif self.state not in self.valid_states:
            logger.warning(
                "Invalid task state", state=self.state, id=self.id, name=self.name
            )
            return

        logger.info("List artifacts", task_id=self.id)
        orig_root_url = queue_service.options["rootUrl"]
        summary = None
        try:
            # Make sure we avoid using the proxy URL.
            queue_service.options["rootUrl"] = tc_config.default_url
            for a in queue_service.listArtifacts(self.id, self.run_id)["artifacts"]:
                if a["name"] == SUMMARY_ARTIFACT_PATH:
                    summary, _ = self.load_artifact(
                        queue_service, SUMMARY_ARTIFACT_PATH
                    )
                    # We don't want to add the summary.json to the artifact_urls list
                    continue

                if a["name"].startswith("public/taskgraph/diffs/"):
                    self.artifact_urls[a["name"]] = queue_service.buildUrl(
                        "getArtifact", self.id, self.run_id, a["name"]
                    )

        except Exception as e:
            logger.warn(
                "Failed to list artifacts",
                task_id=self.id,
                run_id=self.run_id,
                error=e,
            )
            return
        finally:
            queue_service.options["rootUrl"] = orig_root_url

        logger.info("Parsing the summary.json artifact if it exists", task_id=self.id)
        if summary is None:
            logger.warn("Missing summary.json")
        elif "status" in summary and summary["status"] == "WARNING":
            logger.info(
                "TaskGraphDiff summary status is in WARNING, the #taskgraph-reviewers group will be added to the revision"
            )
            self.extra_reviewers_groups.append("taskgraph-reviewers")

        # We don't actually want the contents of these artifacts, just their
        # urls (which are now stored in `self.artifact_urls`).
        return {}