Beispiel #1
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)
Beispiel #3
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)