How to use the libmozevent.storage.EphemeralStorage function in libmozevent

To help you get started, we’ve selected a few libmozevent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / code-review / events / code_review_events / bugbug_utils.py View on Github external
)

        risk_analysis_users = taskcluster_config.secrets.get("risk_analysis_users", [])

        if len(risk_analysis_users) > 0:
            self.risk_analysis_users = {
                user["phid"]: user["fields"]["username"]
                for user in phabricator_api.search_users(
                    constraints={"usernames": risk_analysis_users}
                )
            }
        else:
            self.risk_analysis_users = {}

        # A map from try push task group to its linked Phabricator build.
        self.task_group_to_push = EphemeralStorage(
            "bugbug:task_group_to_push", EPHEMERAL_STORAGE_EXPIRATION
        )
        # A map from build phid to try revision.
        self.diff_to_push = EphemeralStorage(
            "bugbug:diff_to_push", EPHEMERAL_STORAGE_EXPIRATION
        )

        # Setup Taskcluster community hooks for risk analysis
        community_config = taskcluster_config.secrets.get("taskcluster_community")
        if community_config is not None:
            self.community_tc = {
                "hooks": community_taskcluster_config.get_service("hooks"),
                "queue": community_taskcluster_config.get_service("queue"),
            }

            if self.test_selection_enabled:
github mozilla / code-review / events / code_review_events / bugbug_utils.py View on Github external
if len(risk_analysis_users) > 0:
            self.risk_analysis_users = {
                user["phid"]: user["fields"]["username"]
                for user in phabricator_api.search_users(
                    constraints={"usernames": risk_analysis_users}
                )
            }
        else:
            self.risk_analysis_users = {}

        # A map from try push task group to its linked Phabricator build.
        self.task_group_to_push = EphemeralStorage(
            "bugbug:task_group_to_push", EPHEMERAL_STORAGE_EXPIRATION
        )
        # A map from build phid to try revision.
        self.diff_to_push = EphemeralStorage(
            "bugbug:diff_to_push", EPHEMERAL_STORAGE_EXPIRATION
        )

        # Setup Taskcluster community hooks for risk analysis
        community_config = taskcluster_config.secrets.get("taskcluster_community")
        if community_config is not None:
            self.community_tc = {
                "hooks": community_taskcluster_config.get_service("hooks"),
                "queue": community_taskcluster_config.get_service("queue"),
            }

            if self.test_selection_enabled:
                logger.info("Risk analysis and test selection triggers are enabled")
            else:
                logger.info(
                    "Risk analysis trigger is enabled, test selection trigger is disabled"