def start_device(self, device_id, timeout=300): """ start necessary drivers and agents for instrument, put into streaming mode """ start_time = time.time() give_up_time = start_time + timeout pause_time = 5 # too big = wait longer than needed ; too small = check too frequently try: log.debug('starting agent for device %s', device_id) ServiceApi.instrument_agent_start(device_id) # launches instrument agent (not yet driver) except Exception,e: log.warn('failed to start device %s: %s',device_id,e, exc_info=True) self.report(OperationResult(result='failed to start device '+device_id, exception=e)) return
def list_instruments(self): """ perform lookup used by ion-ux to generate list of devices """ out = ServiceApi.find_by_resource_type('InstrumentDevice') log.trace('out: %r', out) while isinstance(out[0], list): log.warn('have list of lists -- should have list of devices!') out = out[0] log.trace('out: %r', out) return out
def lookup_instrument(self, device_id): """ perform service gateway lookups ordinarily performed by ion-ux to load a device """ instrument = ServiceApi.find_instrument(device_id)