Example #1
0
    def onJoin(self, details):
        """
        Called when worker process has joined the node's management realm.
        """
        yield WorkerController.onJoin(self, details, publish_ready=False)

        # WorkerController.publish_ready()
        yield self.publish_ready()
Example #2
0
    def onJoin(self, details):
        """
        Called when worker process has joined the node's management realm.
        """
        yield WorkerController.onJoin(self, details, publish_ready=False)

        # WorkerController.publish_ready()
        yield self.publish_ready()
Example #3
0
    def onJoin(self, details):
        """
        Called when worker process has joined the node's management realm.
        """
        self.log.info('Container worker "{worker_id}" session {session_id} initializing ..', worker_id=self._worker_id, session_id=details.session)
        yield WorkerController.onJoin(self, details, publish_ready=False)

        self.log.info('Container worker "{worker_id}" session ready', worker_id=self._worker_id)

        # WorkerController.publish_ready()
        yield self.publish_ready()
Example #4
0
    def onJoin(self, details):
        """
        Called when worker process has joined the node's management realm.
        """
        self.log.info('Container worker "{worker_id}" session {session_id} initializing ..', worker_id=self._worker_id, session_id=details.session)
        yield WorkerController.onJoin(self, details, publish_ready=False)

        self.log.info('Container worker "{worker_id}" session ready', worker_id=self._worker_id)

        # WorkerController.publish_ready()
        yield self.publish_ready()
Example #5
0
    def onJoin(self, details, publish_ready=True):
        """
        Called when worker process has joined the node's management realm.
        """
        self.log.info('Router worker session for "{worker_id}" joined realm "{realm}" on node router {method}',
                      realm=self._realm,
                      worker_id=self._worker_id,
                      session_id=details.session,
                      method=hltype(RouterController.onJoin))

        yield WorkerController.onJoin(self, details, publish_ready=False)

        # WorkerController.publish_ready()
        self.publish_ready()

        self.log.info('Router worker session for "{worker_id}" ready',
                      worker_id=self._worker_id)
Example #6
0
    def onJoin(self, details, publish_ready=True):
        """
        Called when worker process has joined the node's management realm.
        """
        self.log.info('Router worker session for "{worker_id}" joined realm "{realm}" on node router {method}',
                      realm=self._realm,
                      worker_id=self._worker_id,
                      session_id=details.session,
                      method=hltype(RouterController.onJoin))

        yield WorkerController.onJoin(self, details, publish_ready=False)

        # WorkerController.publish_ready()
        self.publish_ready()

        self.log.info('Router worker session for "{worker_id}" ready',
                      worker_id=self._worker_id)
Example #7
0
    def onJoin(self, details):
        self.log.info('HostMonitor connected (monitors available: {monitors})',
                      monitors=sorted(MONITORS.keys()))

        yield WorkerController.onJoin(self, details, publish_ready=False)

        # register monitor procedures
        dl = []
        for monitor in self._monitors.values():
            d = self.register(monitor.get,
                              u'{}.get_{}'.format(self._prefix, monitor.ID))
            dl.append(d)
        res = yield DeferredList(dl, fireOnOneErrback=True)
        print(res)
        self.log.info('HostMonitor {pcnt} procedures registered',
                      pcnt=len(res))

        # signal this worker is done with setup and ready
        yield self.publish_ready()
Example #8
0
    def onJoin(self, details, publish_ready=True):
        self.log.info(
            'XBR Markets Worker starting (realm={realm}, prefix="{prefix}", session={session}, authid={authid}, authrole={authrole})',
            realm=hlid(details.realm),
            prefix=hlid(self._uri_prefix),
            session=hlid(details.session),
            authid=hlid(details.authid),
            authrole=hlid(details.authrole))
        self.log.info('XBR Markets Worker configuration:\n\n{config}', config=pformat(self.config.extra))

        self._status = self.STATUS_STARTING

        yield WorkerController.onJoin(self, details, publish_ready=False)

        # any special session setup for the market maker goes here ..

        # start blockchain monitor is running on a background thread which exits once this gets False
        self._run_monitor = threading.Event()
        self._stop_monitor = False

        # FIXME: check self.xbr.blocks for latest block already processed
        # initially begin scanning the blockchain with this block, and subsequently scan from the last
        # processed and locally persisted block record in the database
        if 'from_block' in self._blockchain_config:
            scan_from_block = self._blockchain_config['from_block']
            self.log.info('Initial scanning of blockchain beginning with block {scan_from_block} from configuration',
                          scan_from_block=scan_from_block)
        else:
            scan_from_block = 1
            self.log.info('Initial scanning of blockchain from block 1 (!)')

        # monitor/pull blockchain from a background thread
        self._monitor_blockchain_thread = self._reactor.callInThread(self._monitor_blockchain, self._bc_gw_config,
                                                                     scan_from_block)
        self._status = self.STATUS_RUNNING

        yield self.publish_ready()

        self.log.info('XBR Markets Worker ready!')