def get_agent_desc_for_instrument(self, instrument_id):
        logging.info("get_agent_desc_for_instrument() instrumentID="+str(instrument_id))
        int_ref = ResourceReference(RegistryIdentity=instrument_id, RegistryBranch='master')
        agent_query = InstrumentAgentResourceInstance()
        agent_query.instrument_ref = int_ref


        if not agent_res:
            defer.returnValue(None)
        agent_pid = agent_res.proc_id
        logging.info("Agent process id for instrument id %s is: %s" % (instrument_id, agent_pid))
        defer.returnValue(agent_pid)
 def get_agent_for_instrument(self, instrument_id):
     logging.info("get_agent_for_instrument() instrumentID="+str(instrument_id))
     int_ref = ResourceReference(RegistryIdentity=instrument_id, RegistryBranch='master')
     agent_query = InstrumentAgentResourceInstance()
     agent_query.instrument_ref = int_ref
     # @todo Need to list the LC state here. WHY???
     agent_query.lifecycle = LCStates.developed
     agents = yield self.arc.find_registered_agent_instance_from_description(agent_query, regex=False)
     logging.info("Found %s agent instances for instrument id %s" % (len(agents), instrument_id))
     agent_res = None
     if len(agents) > 0:
         agent_res = agents[0]
     defer.returnValue(agent_res)
Exemple #3
0
    def get_agent_desc_for_instrument(self, instrument_id):
        logging.info("get_agent_desc_for_instrument() instrumentID=" +
                     str(instrument_id))
        int_ref = ResourceReference(RegistryIdentity=instrument_id,
                                    RegistryBranch='master')
        agent_query = InstrumentAgentResourceInstance()
        agent_query.instrument_ref = int_ref

        if not agent_res:
            defer.returnValue(None)
        agent_pid = agent_res.proc_id
        logging.info("Agent process id for instrument id %s is: %s" %
                     (instrument_id, agent_pid))
        defer.returnValue(agent_pid)
 def register_resource(self, instrument_id):
     """
     Register the resource. Since this is a subclass, make the appropriate
     resource description for the registry and pass that into the
     registration call.
     """
     ia_instance = InstrumentAgentResourceInstance()
     ci_params = yield self.get_from_CI([driver_address])
     ia_instance.driver_process_id = ci_params[driver_address]
     ia_instance.instrument_ref = ResourceReference(
         RegistryIdentity=instrument_id, RegistryBranch='master')
     result = yield ResourceAgentClient.register_resource(self,
                                                          ia_instance)
     defer.returnValue(result)
    def setUp(self):
        yield self._start_container()

        # use some sort of agent...doesnt really matter what kind, does it
        processes = [{
            'name': 'testAgent',
            'module': 'ion.agents.instrumentagents.SBE49_IA',
            'class': 'SBE49InstrumentAgent'
        }, {
            'name': 'agent_registry',
            'module': 'ion.services.coi.agent_registry',
            'class': 'AgentRegistryService'
        }]
        self.sup = yield self._spawn_processes(processes)
        self.svc_id = self.sup.get_child_id('testAgent')
        self.rr_id = self.sup.get_child_id('agent_registry')

        # Start a client (for the RPC)
        self.RAClient = ResourceAgentClient(proc=self.sup, target=self.svc_id)

        # RR Client is ,,,,,desired only for testing
        self.reg_client = AgentRegistryClient(proc=self.sup)
        yield self.reg_client.clear_registry()

        # need any non-generic resource...use an instrument agent one for now
        self.res_desc = \
            InstrumentAgentResourceDescription.create_new_resource()
        #self.res_desc.version = '1.23'
        self.res_desc.name = 'I am a test IA resource description'

        self.res_inst = InstrumentAgentResourceInstance.create_new_resource()
        self.res_inst.driver_process_id = 'something_for_now.1'
        self.res_inst.name = 'I am an instantiation of a test IA resource'
    def setUp(self):
        yield self._start_container()

        # use some sort of agent...doesnt really matter what kind, does it
        processes = [
            {'name':'testAgent',
             'module':'ion.agents.instrumentagents.SBE49_IA',
             'class':'SBE49InstrumentAgent'},
            {'name':'agent_registry',
             'module':'ion.services.coi.agent_registry',
             'class':'AgentRegistryService'}
        ]
        self.sup = yield self._spawn_processes(processes)
        self.svc_id = self.sup.get_child_id('testAgent')
        self.rr_id = self.sup.get_child_id('agent_registry')

        # Start a client (for the RPC)
        self.RAClient = ResourceAgentClient(proc=self.sup, target=self.svc_id)

        # RR Client is ,,,,,desired only for testing
        self.reg_client = AgentRegistryClient(proc=self.sup)
        yield self.reg_client.clear_registry()

        # need any non-generic resource...use an instrument agent one for now
        self.res_desc = \
            InstrumentAgentResourceDescription.create_new_resource()
        #self.res_desc.version = '1.23'
        self.res_desc.name = 'I am a test IA resource description'

        self.res_inst = InstrumentAgentResourceInstance.create_new_resource()
        self.res_inst.driver_process_id = 'something_for_now.1'
        self.res_inst.name = 'I am an instantiation of a test IA resource'
Exemple #7
0
 def get_agent_for_instrument(self, instrument_id):
     logging.info("get_agent_for_instrument() instrumentID=" +
                  str(instrument_id))
     int_ref = ResourceReference(RegistryIdentity=instrument_id,
                                 RegistryBranch='master')
     agent_query = InstrumentAgentResourceInstance()
     agent_query.instrument_ref = int_ref
     # @todo Need to list the LC state here. WHY???
     agent_query.lifecycle = LCStates.developed
     agents = yield self.arc.find_registered_agent_instance_from_description(
         agent_query, regex=False)
     logging.info("Found %s agent instances for instrument id %s" %
                  (len(agents), instrument_id))
     agent_res = None
     if len(agents) > 0:
         agent_res = agents[0]
     defer.returnValue(agent_res)