示例#1
0
    def run(self):

        # Build hooks for each conf
        hooks = [
            self.build_hook(conf)
            for conf in self.hooks_configuration
        ]
        if not hooks:
            raise Exception('No hooks created')

        # Run hooks pulse listeners together
        # but only use hooks with active definitions
        consumers = [
            hook.build_consumer(self.pulse_user, self.pulse_password)
            for hook in hooks
            if hook.connect_taskcluster(
                self.taskcluster_client_id,
                self.taskcluster_access_token,
            )
        ]

        # Add monitoring process
        consumers.append(task_monitoring.run())

        # Run all consumers together
        run_consumer(asyncio.gather(*consumers))
示例#2
0
    def run(self):

        # Build hooks for each conf
        hooks = [self.build_hook(conf) for conf in self.hooks_configuration]
        if not hooks:
            raise Exception('No hooks created')

        # Run hooks pulse listeners together
        # but only use hooks with active definitions
        def _connect(hook):
            out = hook.connect_taskcluster(
                self.taskcluster_client_id,
                self.taskcluster_access_token,
            )
            if self.mercurial is not None:
                out &= hook.connect_mercurial_queue(self.mercurial.queue)
            return out

        consumers = [
            hook.build_consumer(self.pulse_user, self.pulse_password)
            for hook in hooks if _connect(hook)
        ]

        # Add monitoring process
        consumers.append(task_monitoring.run())

        # Add mercurial process
        if self.mercurial is not None:
            consumers.append(self.mercurial.run())

        # Hooks through web server
        consumers.append(self.build_webserver(hooks))

        # Run all consumers together
        run_consumer(asyncio.gather(*consumers))
示例#3
0
    def run(self, hooks):

        # Load hook group/id combos
        self.load_hooks(hooks)

        # Run forever consumer below
        logger.info('Listening for new messages...')
        run_consumer(self.consumer)
示例#4
0
def cmd():
    app_config = flask.current_app.config
    app_channel = app_config["APP_CHANNEL"]
    git_repo_url = app_config["PRODUCT_DETAILS_GIT_REPO_URL"]
    pulse_user = app_config["PULSE_USER"]
    pulse_pass = app_config["PULSE_PASSWORD"]
    exchange = f"exchange/{pulse_user}/{PROJECT_NAME}"
    folder_in_repo = "public/"
    rebuild_product_details_consumer = create_consumer(
        pulse_user,
        pulse_pass,
        exchange,
        PULSE_ROUTE_REBUILD_PRODUCT_DETAILS,
        rebuild_product_details(git_repo_url, folder_in_repo, app_channel,
                                BREAKPOINT_VERSION),
    )
    logger.info("Listening for new messages on %s %s", exchange,
                PULSE_ROUTE_REBUILD_PRODUCT_DETAILS)
    run_consumer(asyncio.gather(*[rebuild_product_details_consumer]))
示例#5
0
    def run(self):

        # Build hooks for each conf
        hooks = [
            self.build_hook(conf)
            for conf in self.hooks_configuration
        ]
        if not hooks:
            raise Exception('No hooks created')

        # Run hooks pulse listeners together
        # but only use hooks with active definitions
        def _connect(hook):
            out = hook.connect_taskcluster(
                self.taskcluster_client_id,
                self.taskcluster_access_token,
            )
            out &= hook.connect_queues(
                mercurial_queue=self.mercurial.queue if self.mercurial else None,
                web_queue=self.webserver.queue,
            )
            return out
        consumers = [
            hook.build_consumer(self.pulse_user, self.pulse_password)
            for hook in hooks
            if _connect(hook)
        ]

        # Add monitoring task
        consumers.append(task_monitoring.run())

        # Add mercurial task
        if self.mercurial is not None:
            consumers.append(self.mercurial.run())

        # Start the web server in its own process
        web_process = self.webserver.start()

        # Run all tasks concurrently
        run_consumer(asyncio.gather(*consumers))

        web_process.join()
示例#6
0
    def run(self):

        # Build hooks for each conf
        hooks = [
            self.build_hook(conf)
            for conf in self.pulse_listener_hooks
        ]
        if not hooks:
            raise Exception('No hooks created')

        # Run hooks pulse listeners together
        # but only use hoks with active definitions
        consumers = [
            hook.connect_pulse(self.pulse_user, self.pulse_password)
            for hook in hooks
            if hook.connect_taskcluster(
                self.taskcluster_client_id,
                self.taskcluster_access_token,
            )
        ]
        run_consumer(asyncio.gather(*consumers))
示例#7
0
    def run(self):

        # Build hooks for each conf
        hooks = [
            self.build_hook(conf)
            for conf in self.hooks_configuration
        ]
        if not hooks:
            raise Exception('No hooks created')

        # Run hooks pulse listeners together
        # but only use hooks with active definitions
        def _connect(hook):
            out = hook.connect_taskcluster(
                self.taskcluster_client_id,
                self.taskcluster_access_token,
            )
            if self.mercurial is not None:
                out &= hook.connect_mercurial_queue(self.mercurial.queue)
            return out
        consumers = [
            hook.build_consumer(self.pulse_user, self.pulse_password)
            for hook in hooks
            if _connect(hook)
        ]

        # Add monitoring process
        consumers.append(task_monitoring.run())

        # Add mercurial process
        if self.mercurial is not None:
            consumers.append(self.mercurial.run())

        # Hooks through web server
        consumers.append(self.build_webserver(hooks))

        # Run all consumers together
        run_consumer(asyncio.gather(*consumers))