当前位置: 首页>>代码示例>>Python>>正文


Python ipubsub_management_service.PubsubManagementServiceProcessClient类代码示例

本文整理汇总了Python中interface.services.dm.ipubsub_management_service.PubsubManagementServiceProcessClient的典型用法代码示例。如果您正苦于以下问题:Python PubsubManagementServiceProcessClient类的具体用法?Python PubsubManagementServiceProcessClient怎么用?Python PubsubManagementServiceProcessClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PubsubManagementServiceProcessClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_start

    def on_start(self):
        '''
        Starts the process
        '''
        log.info('Replay Process Started')
        super(ReplayProcess,self).on_start()
        dsm_cli = DatasetManagementServiceProcessClient(process=self)
        pubsub  = PubsubManagementServiceProcessClient(process=self)

        self.dataset_id      = self.CFG.get_safe('process.dataset_id', None)
        self.delivery_format = self.CFG.get_safe('process.delivery_format',{})
        self.start_time      = self.CFG.get_safe('process.query.start_time', None)
        self.end_time        = self.CFG.get_safe('process.query.end_time', None)
        self.stride_time     = self.CFG.get_safe('process.query.stride_time', None)
        self.parameters      = self.CFG.get_safe('process.query.parameters',None)
        self.publish_limit   = self.CFG.get_safe('process.query.publish_limit', 10)
        self.tdoa            = self.CFG.get_safe('process.query.tdoa',None)
        self.stream_id       = self.CFG.get_safe('process.publish_streams.output', '')
        self.stream_def      = pubsub.read_stream_definition(stream_id=self.stream_id)
        self.stream_def_id   = self.stream_def._id

        self.publishing.clear()
        self.play.set()
        self.end.clear()

        if self.dataset_id is None:
            raise BadRequest('dataset_id not specified')

        self.dataset = dsm_cli.read_dataset(self.dataset_id)
        self.pubsub = PubsubManagementServiceProcessClient(process=self)
开发者ID:swarbhanu,项目名称:coi-services,代码行数:30,代码来源:replay_process.py

示例2: on_start

    def on_start(self):
        #print ">>>>>>>>>>>>>>>>>>>>>> MPL CFG = ", self.CFG

        self.pubsub_management = PubsubManagementServiceProcessClient(process=self)
        self.ssclient = SchedulerServiceProcessClient(process=self)
        self.rrclient = ResourceRegistryServiceProcessClient(process=self)
        self.data_retriever_client = DataRetrieverServiceProcessClient(process=self)
        self.dsm_client = DatasetManagementServiceProcessClient(process=self)
        self.pubsub_client = PubsubManagementServiceProcessClient(process = self)

        self.stream_info  = self.CFG.get_safe('process.publish_streams',{})
        self.stream_names = self.stream_info.keys()
        self.stream_ids   = self.stream_info.values()

        if not self.stream_names:
            raise BadRequest('MPL Transform has no output streams.')

        graph_time_periods= self.CFG.get_safe('graph_time_periods')

        # If this is meant to be an event driven process, schedule an event to be generated every few minutes/hours
        self.event_timer_interval = self.CFG.get_safe('graph_gen_interval')
        if self.event_timer_interval:
            event_origin = "Interval_Timer_Matplotlib"
            sub = EventSubscriber(event_type="ResourceEvent", callback=self.interval_timer_callback, origin=event_origin)
            sub.start()

            self.interval_timer_id = self.ssclient.create_interval_timer(start_time="now" , interval=self._str_to_secs(self.event_timer_interval),
                event_origin=event_origin, event_subtype="")

        super(VizTransformMatplotlibGraphs,self).on_start()
开发者ID:Bobfrat,项目名称:coi-services,代码行数:30,代码来源:matplotlib_graphs.py

示例3: on_start

    def on_start(self):

        pubsub_cli = PubsubManagementServiceProcessClient(process=self, node=self.container.node)

        # Get the stream(s)
        stream_id = self.CFG.get_safe('process.stream_id','')


        query = StreamQuery(stream_ids=[stream_id,])

        exchange_name = 'dispatcher_%s' % self.id

        subscription_id = pubsub_cli.create_subscription(
            query = query,
            exchange_name = exchange_name,
            name = "SampleSubscription",
            description = "Sample Subscription Description")


        stream_subscriber = StreamSubscriberRegistrar(process=self, node=self.container.node)

        def message_received(granule, h):

            rdt = RecordDictionaryTool.load_from_granule(granule)

            log.warn('Logging Record Dictionary received in logger subscription  \n%s', rdt.pretty_print())

        subscriber = stream_subscriber.create_subscriber(exchange_name=exchange_name, callback=message_received)
        subscriber.start()

        pubsub_cli.activate_subscription(subscription_id)
开发者ID:seman,项目名称:coi-services,代码行数:31,代码来源:stream_granule_logger.py

示例4: on_start

    def on_start(self):
        super(SalinityTransform, self).on_start()

        self.sal_stream = self.CFG.process.publish_streams.values()[0]

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_definition = pubsub.read_stream_definition(stream_id=self.sal_stream)
开发者ID:Bobfrat,项目名称:coi-services,代码行数:8,代码来源:ctd_L2_salinity.py

示例5: on_start

    def on_start(self):

        rr_cli = ResourceRegistryServiceProcessClient(process=self, node=self.container.node)
        pubsub_cli = PubsubManagementServiceProcessClient(process=self, node=self.container.node)

        # Get the stream(s)
        data_product_id = self.CFG.get_safe('dispatcher.data_product_id','')

        stream_ids,_ = rr_cli.find_objects(subject=data_product_id, predicate=PRED.hasStream, id_only=True)

        log.info('Got Stream Ids: "%s"', stream_ids)
        assert stream_ids, 'No streams found for this data product!'


        exchange_name = 'dispatcher_%s' % str(os.getpid())
        subscription_id = pubsub_cli.create_subscription(
                name='SampleSubscription', 
                exchange_name=exchange_name,
                stream_ids=stream_ids,
                description='Sample Subscription Description'
                )


        stream_defs = {}

        def message_received(message, stream_route, stream_id):
            granule = message

            stream_id = granule.stream_resource_id

            data_stream_id = granule.data_stream_id
            data_stream = granule.identifiables[data_stream_id]

            tstamp = get_datetime(data_stream.timestamp.value)

            records = granule.identifiables['record_count'].value
            

            log.info('Received a message from stream %s with time stamp %s and %d records' % (stream_id, tstamp, records))


            if stream_id not in stream_defs:
                stream_defs[stream_id] = pubsub_cli.find_stream_definition(stream_id, id_only=False).container
            stream_def = stream_defs.get(stream_id)

            sp = PointSupplementStreamParser(stream_definition=stream_def, stream_granule=granule)

            last_data = {}
            for field in sp.list_field_names():
                last_data[field] = sp.get_values(field)[-1]

            log.info('Last values in the message: %s' % str(last_data))


        subscriber = StreamSubscriber(process=self, exchange_name=exchange_name, callback=message_received)
        subscriber.start()

        pubsub_cli.activate_subscription(subscription_id)
开发者ID:Bobfrat,项目名称:coi-services,代码行数:58,代码来源:simple_dispatcher.py

示例6: on_start

    def on_start(self):
        super(EventTriggeredTransform_A, self).on_start()

        self.awake = False

        self.cond_stream = self.CFG.process.publish_streams.values()[0]

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_definition = pubsub.read_stream_definition(stream_id=self.cond_stream)
开发者ID:jamie-cyber1,项目名称:coi-services,代码行数:10,代码来源:event_triggered_transform.py

示例7: on_start

    def on_start(self):
        super(TransformDataProcess,self).on_start()
        if dot.isEnabledFor(logging.INFO):
            pubsub_cli = PubsubManagementServiceProcessClient(process=self)
            self.streams = self.CFG.get_safe('process.publish_streams',{})
            for k,v in self.streams.iteritems():
                stream_route = pubsub_cli.read_stream_route(v)
                queue_name = re.sub(r'[ -]', '_', self.queue_name)

                dot.info('   %s -> %s' %( queue_name, stream_route.routing_key.strip('.stream')))
开发者ID:blazetopher,项目名称:coi-services,代码行数:10,代码来源:transform.py

示例8: on_start

    def on_start(self):
        super(StreamGranuleLogger,self).on_start()

        pubsub_cli = PubsubManagementServiceProcessClient(process=self, node=self.container.node)

        # Get the stream(s)
        stream_id = self.CFG.get_safe('process.stream_id','')
        if stream_id:
            self.subscription_id = pubsub_cli.create_subscription('%s_sub' % self.id, stream_ids=[stream_id], exchange_name=self.queue_name)
            pubsub_cli.activate_subscription(self.subscription_id)
开发者ID:Bobfrat,项目名称:coi-services,代码行数:10,代码来源:stream_granule_logger.py

示例9: on_start

    def on_start(self):
        super(CTDL1ConductivityTransform, self).on_start()

        if not self.CFG.process.publish_streams.has_key('conductivity'):
            raise BadRequest("For CTD transforms, please send the stream_id using "
                             "a special keyword (ex: conductivity)")
        self.cond_stream = self.CFG.process.publish_streams.conductivity

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_definition = pubsub.read_stream_definition(stream_id=self.cond_stream)
开发者ID:blazetopher,项目名称:coi-services,代码行数:11,代码来源:ctd_L1_conductivity.py

示例10: on_start

    def on_start(self):
        super(PresfL1Transform, self).on_start()

        if not self.CFG.process.publish_streams.has_key('seafloor_pressure'):
            raise BadRequest("For the PresfL1Transform, please send the stream_id using "
                             "a special keyword (ex: seafloor_pressure)")

        self.pres_stream = self.CFG.process.publish_streams.seafloor_pressure

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_definition = pubsub.read_stream_definition(stream_id=self.pres_stream)
开发者ID:blazetopher,项目名称:coi-services,代码行数:12,代码来源:presf_L1.py

示例11: on_start

    def on_start(self):
        super(CTDL1TemperatureTransform, self).on_start()

        if not self.CFG.process.publish_streams.has_key('temperature'):
            raise BadRequest("For CTD transforms, please send the stream_id using a "
                                 "special keyword (ex: temperature)")

        self.temp_stream = self.CFG.process.publish_streams.temperature

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_definition = pubsub.read_stream_definition(stream_id=self.temp_stream)
开发者ID:blazetopher,项目名称:coi-services,代码行数:12,代码来源:ctd_L1_temperature.py

示例12: on_start

    def on_start(self):
        super(CTDBP_L0_all, self).on_start()

        self.L0_stream_id = self.CFG.process.publish_streams.values()[0]

        log.debug("the output stream: %s", self.L0_stream_id)

        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_def_L0 = pubsub.read_stream_definition(stream_id=self.L0_stream_id)

        self.params = {'L0_stream' : self.stream_def_L0._id }

        log.debug("the params: %s", self.params)
开发者ID:Bobfrat,项目名称:coi-services,代码行数:13,代码来源:ctdbp_L0.py

示例13: on_start

    def on_start(self):

        pubsub = PubsubManagementServiceProcessClient(process=self)
        if self.CFG.process.publish_streams.has_key("salinity"):
            self.sal_stream = self.CFG.process.publish_streams.salinity
        elif self.CFG.process.publish_streams.has_key("output"):
            self.sal_stream = self.CFG.process.publish_streams.output
            self.salinity = self.output
        self.CFG.process.stream_id = self.sal_stream
        self.stream_id = self.sal_stream
        self.stream_def = pubsub.read_stream_definition(stream_id=self.sal_stream)

        super(SalinityDoubler, self).on_start()
开发者ID:newbrough,项目名称:coi-services,代码行数:13,代码来源:example_double_salinity.py

示例14: on_start

    def on_start(self):
        super(CTDBP_L1_Transform, self).on_start()

        self.L1_stream_id = self.CFG.process.publish_streams.values()[0]

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        stream_def = pubsub.read_stream_definition(stream_id=self.L1_stream_id)
        self.stream_definition_id = stream_def._id

        self.temp_calibration_coeffs = self.CFG.process.calibration_coeffs['temp_calibration_coeffs']
        self.pres_calibration_coeffs = self.CFG.process.calibration_coeffs['pres_calibration_coeffs']
        self.cond_calibration_coeffs = self.CFG.process.calibration_coeffs['cond_calibration_coeffs']
开发者ID:Bobfrat,项目名称:coi-services,代码行数:13,代码来源:ctdbp_L1.py

示例15: on_start

    def on_start(self):
        super(EventTriggeredTransform_B, self).on_start()

        self.awake = False

        if not self.CFG.process.publish_streams.has_key('output'):
            raise BadRequest("For event triggered transform, please send the stream_id "
                             "using the special keyword, output")

        self.output = self.CFG.process.publish_streams.output

        # Read the parameter dict from the stream def of the stream
        pubsub = PubsubManagementServiceProcessClient(process=self)
        self.stream_definition = pubsub.read_stream_definition(stream_id=self.output)
开发者ID:kerfoot,项目名称:coi-services,代码行数:14,代码来源:event_triggered_transform.py


注:本文中的interface.services.dm.ipubsub_management_service.PubsubManagementServiceProcessClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。