def shutter(self, mode): ccd = DeviceProxy('maxi/PI_MTE/1') modes = {'auto': 1, 'close': 2, 'open': 3} try: ccd.shutter_mode = modes[mode] except KeyError: self.output('Unknown mode, expecting "open", "close" or "auto"')
def SetStorageLoggingLevel(self, argin): # PROTECTED REGION ID(SKALogger.SetStorageLoggingLevel) ENABLED START # """ Sets Storage logging level of source device. :parameter: argin: DevVarLogStringArray Array consisting of argin[0]: DevLong. Desired logging level argin[1]: DevString. Desired tango device :returns: None. """ storage_logging_level = argin[0][:] #To convert the type of log level from numpy.ndarray to list. Needs to fix in PyTango. if type(storage_logging_level) is numpy.ndarray: storage_logging_level = storage_logging_level.tolist() else: pass storage_logging_device = argin[1][:] i = 0 while i < len(storage_logging_level[:]): try: self.info_stream("Storage logging level : %s, Device : %s", storage_logging_level[i], storage_logging_device[i]) dev_proxy = DeviceProxy(storage_logging_device[i]) dev_proxy.storageLoggingLevel = storage_logging_level[i] except DevFailed as dev_failed: self.error_stream("Failed to set Storage Logging level for [%s]", storage_logging_device[i]) str_exception = "Exception: " + str(dev_failed) self.error_stream(str_exception) i += 1
class MidLevel2(SKABaseDevice): def init_device(self): super().init_device() self.low_level_device = DeviceProxy("test/low_level/1") @command(dtype_in="str") def CallWithLogger(self, argin): self.logger.info("CallWithLogger, mid 2") argin_json = json.loads(argin) with transaction( "CallWithLogger, mid 2", argin_json, logger=self.logger ) as transaction_id: self.logger.info("CallWithLogger, mid 2") argin_json["transaction_id"] = transaction_id self.low_level_device.CallWithLogger(json.dumps(argin_json)) @command(dtype_in="str") def CallWithoutLogger(self, argin): self.logger.info("CallWithoutLogger, mid 2") argin_json = json.loads(argin) with transaction( "CallWithoutLogger, mid 2", argin_json ) as transaction_id: self.logger.info("CallWithoutLogger, mid 2") argin_json["transaction_id"] = transaction_id self.low_level_device.CallWithoutLogger(json.dumps(argin_json)) @command(dtype_in="str") def NoTransaction(self, argin): self.logger.info("NoTransaction, mid 2") argin_json = json.loads(argin) self.low_level_device.NoTransaction(json.dumps(argin_json))
def main(): """Main function""" ## Get arguments nargs = len(sys.argv) if nargs < 2: sys.exit( 'Missing arguments (please specify starter device name as argument)!' ) device_name = str(sys.argv[1]) # Get Starter proxy print("Retrieving Starter proxy device " + device_name + "...") try: device = DeviceProxy(device_name) except PyTango.DevFailed as df: sys.exit('Tango exception while retrieving device proxy (err=' + str(df) + ')') #print(str(df)) # Stop servers with ordered levels (from 5 to 1) stop_levels = [5, 4, 3, 2, 1] for stop_level in stop_levels: print("Stopping device servers @ level " + str(stop_level) + "...") try: device.command_inout("DevStopAll", stop_level) except PyTango.DevFailed as df: sys.exit('Tango exception while stopping servers @ level ' + str(stop_level) + ' (err=' + str(df) + ')') print("All servers stopped with success")
def tape_on(self): """Macro tape_on""" self.output("Running tape_on...") proxy = DeviceProxy('xpl/debristape/rsxs') proxy.start_all() sleep(0.5) self.output("Tape is ON!")
def __init__(self, conf_manager='archiving/hdbpp/confmanager01', eventsubscriber='archiving/hdbpp/eventsubscriber01'): self.conf_manager = conf_manager self.eventsubscriber = eventsubscriber self.conf_manager_proxy = DeviceProxy(self.conf_manager) self.evt_subscriber_proxy = DeviceProxy(self.eventsubscriber)
def release_resources(): CentralNodeLow = DeviceProxy("ska_low/tm_central/central_node") release_resources_file = ( "resources/test_data/TMC_integration/mccs_release_resources.json" ) release_resource_str = load_config_from_file(release_resources_file) CentralNodeLow.ReleaseResources(release_resource_str)
def scan(): scan_file = 'resources/test_data/TMC_integration/mccs_scan.json' scan_string = load_config_from_file(scan_file) SubarrayNodeLow = DeviceProxy('ska_low/tm_subarray_node/1') SubarrayNodeLow.Scan(scan_string) # subarray.scan() LOGGER.info("scan command is invoked")
def hysteresis(self): ccd = DeviceProxy('maxi/pi_mte/1') currents = np.concatenate([ np.linspace(0.6, 0.15, 5), np.linspace(0.15, -0.6, 80)[1:] ]) mag = self.getMotor('magnet') ccd.accumulations = 1 self.execMacro('ct 0.05') for i in range(5): t = self.execMacro('adjust_exposure').getResult() self.execMacro(f'ct {t:.3f}') for i, c in enumerate(currents): mag.move(c) self.output(f'magnet: {c}') t = self.execMacro('adjust_exposure').getResult() self.output(f'exposure time: {t:.3f}') if i % 20 == 0: ccd.accumulations = 10 self.execMacro(f'acquire_xmcd {t:.3f}') else: ccd.accumulations = 20 self.execMacro(f'acquire {t:.3f}')
def restart(): resource("ska_low/tm_subarray_node/1").assert_attribute("obsState").equals( "ABORTED") SubarrayNode = DeviceProxy("ska_low/tm_subarray_node/1") SubarrayNode.Restart() LOGGER.info("Subarray obsState is: " + str(SubarrayNode.obsState)) LOGGER.info("Invoked restart on Subarray")
def do(self, argin): """ Stateless hook for SetLoggingLevel() command functionality. :return: A tuple containing a return code and a string message indicating status. The message is for information purpose only. :rtype: (ResultCode, str) """ logging_levels = argin[0][:] logging_devices = argin[1][:] for level, device in zip(logging_levels, logging_devices): try: new_level = LoggingLevel(level) self.logger.info("Setting logging level %s for %s", new_level, device) dev_proxy = DeviceProxy(device) dev_proxy.loggingLevel = new_level except DevFailed: self.logger.exception( "Failed to set logging level %s for %s", level, device) message = "SetLoggingLevel command completed OK" self.logger.info(message) return (ResultCode.OK, message)
def restart(self): # current suggested method is through 'init' maybe reset would be better in future # reset method is allowed only when device is in FAULT state. p = DeviceProxy(self.device_name) LOGGER.info('Inside restart method invoking init API.') p.init() LOGGER.info('Inside restart method init API invoked successfully.')
def __init__(self, inst, props, *args, **kwargs): """Constructor""" TwoDController.__init__(self, inst, props, *args, **kwargs) print('GreatEyes Tango Initialization ...') self.proxy = DeviceProxy(self.tangoFQDN) print('SUCCESS') self._axes = {}
def __init__(self, resource, attribute, desired=None, predicate=None, require_transition=False, start_now=True, polling=100): self.device_proxy = DeviceProxy(resource.device_name) self.device_name = resource.device_name self.future_value = desired self.polling = polling self.attribute = attribute self.attr = attribute self.previous_value = None self.current_value = None self.is_changed = False self.require_transition = require_transition self.result_available = threading.Event() self.current_subscription = None self.original_polling = None self.waiting = False if predicate is None: self.predicate = self._default_predicate else: self.predicate = predicate if start_now: self.start_listening()
def init_device(self): Device.init_device(self) try: self.pilc = DeviceProxy(self.PiLCFQDN) self.info_stream('Connected to PiLC: {:s}'.format(self.PiLCFQDN)) except: self.error_stream('Could not connect to PiLC: {:s}'.format( self.PiLCFQDN)) return self.set_state(DevState.OFF) self.set_state(DevState.ON) self.db = Database() try: attr = self.db.get_device_attribute_property( self.get_name(), ["exposure"]) self._exposure = int(attr["exposure"]["__value"][0]) except Exception: self._exposure = -1 try: attr = self.db.get_device_attribute_property( self.get_name(), ["mode"]) self._mode = int(attr["mode"]["__value"][0]) except Exception: self._mode = 0
def configuring_sub(sdp_block, configure_file): update_scan_config_file(configure_file, sdp_block) config = load_config_from_file(configure_file) SubarrayNode = DeviceProxy('ska_mid/tm_subarray_node/1') SubarrayNode.Configure(config) LOGGER.info("Subarray obsState is: " + str(SubarrayNode.obsState)) LOGGER.info('Invoked Configure on Subarray')
def ConfigureCapability(self, argin): # PROTECTED REGION ID(SKASubarray.ConfigureCapability) ENABLED START # """Configures number of instances for each capability. If the capability exists, it increments the configured instances by the number of instances requested, otherwise an exception will be raised. Note: The two lists arguments must be of equal length or an exception will be raised.""" command_name = 'ConfigureCapability' dp = DeviceProxy(self.get_name()) obstate_labels = list(dp.attribute_query('obsState').enum_labels) obs_configuring = obstate_labels.index('CONFIGURING') capabilities_instances, capability_types = argin self._validate_capability_types(command_name, capability_types) self._validate_input_sizes(command_name, argin) # Set obsState to 'CONFIGURING'. self._obs_state = obs_configuring # Perform the configuration. for capability_instances, capability_type in zip( capabilities_instances, capability_types): self._configured_capabilities[ capability_type] += capability_instances # Change the obsState to 'READY'. obs_ready = obstate_labels.index('READY') self._obs_state = obs_ready
def start_up(): CentralNodeLow = DeviceProxy("ska_low/tm_central/central_node") LOGGER.info( "Before Sending StartupTelescope command on CentralNodeLow state :" + str(CentralNodeLow.State()) ) CentralNodeLow.StartUpTelescope()
def end(): resource("ska_low/tm_subarray_node/1").assert_attribute("obsState").equals("READY") resource("low-mccs/subarray/01").assert_attribute("obsState").equals("READY") LOGGER.info("Before invoking End Command all the devices obsstate is ready") SubarrayNodeLow = DeviceProxy("ska_low/tm_subarray_node/1") SubarrayNodeLow.End() LOGGER.info("Invoked End on Subarray")
def obsreset(): resource('ska_low/tm_subarray_node/1').assert_attribute('obsState').equals( 'ABORTED') SubarrayNodeLow = DeviceProxy('ska_low/tm_subarray_node/1') SubarrayNodeLow.ObsReset() LOGGER.info("Subarray obsState is: " + str(SubarrayNodeLow.obsState)) LOGGER.info('Invoked ObsReset command on Subarray')
def configure_sub(): # resource('ska_low/tm_subarray_node/1').assert_attribute('State').equals('ON') configure_file = "resources/test_data/TMC_integration/mccs_configure.json" config = load_config_from_file(configure_file) SubarrayNodeLow = DeviceProxy("ska_low/tm_subarray_node/1") SubarrayNodeLow.Configure(config) LOGGER.info("Subarray obsState is: " + str(SubarrayNodeLow.obsState)) LOGGER.info("Invoked Configure on Subarray")
def abort(): resource("ska_mid/tm_subarray_node/1").assert_attribute( "State").equals("ON") resource("ska_mid/tm_subarray_node/1").assert_attribute( "obsState").equals("CONFIGURING") SubarrayNode = DeviceProxy("ska_mid/tm_subarray_node/1") SubarrayNode.Abort() LOGGER.info("Invoked Abort on Subarray")
def configure_sub(sdp_block, configure_file): #resource('ska_mid/tm_subarray_node/1').assert_attribute('State').equals('ON') update_scan_config_file(configure_file, sdp_block) config = load_config_from_file(configure_file) SubarrayNode = DeviceProxy('ska_mid/tm_subarray_node/1') SubarrayNode.Configure(config) LOGGER.info("Subarray obsState is: " + str(SubarrayNode.obsState)) LOGGER.info('Invoked Configure on Subarray')
def __init__(self, inst, props, *args, **kwargs): """Constructor""" TriggerGateController.__init__(self, inst, props, *args, **kwargs) print('PiLC Initialization on {:s} ...'.format(self.tangoFQDN)) self._log.info('PiLC Initialization ...') self.proxy = DeviceProxy(self.tangoFQDN) print('SUCCESS') self.__start_time = None
def configure_sub(): configure1_file = "resources/test_data/TMC_integration/mccs_configure.json" config = load_config_from_file(configure1_file) LOGGER.info("Configuring a scan for subarray 1") fixture["state"] = "Subarray CONFIGURING" SubarrayNode = DeviceProxy("ska_low/tm_subarray_node/1") SubarrayNode.Configure(config) LOGGER.info("Invoked Configure on Subarray")
def obsreset(): resource("ska_low/tm_subarray_node/1").assert_attribute("obsState").equals( "ABORTED" ) SubarrayNodeLow = DeviceProxy("ska_low/tm_subarray_node/1") SubarrayNodeLow.ObsReset() LOGGER.info("Subarray obsState is: " + str(SubarrayNodeLow.obsState)) LOGGER.info("Invoked ObsReset command on Subarray")
def laser_on(self): """Macro laser_on""" is_enabled = DeviceProxy('laser/ThorlabsSC10/seed').enabled if is_enabled: self.warning('The seed shutter is still enabled! Can not flip mirror!') return proxy = DeviceProxy('laser/ThorlabsMFF100/compressor') proxy.Open() self.output("Laser mirror opened!")
def init_device(self): """Device constructor.""" Device.init_device(self) # Add anything here that has to be done before the device is set to # its ON state. self._set_master_state('on') self._devProxy = DeviceProxy(self.get_name())
def probe_off(self): """Macro laser_off""" is_enabled = DeviceProxy('laser/ThorlabsSC10/seed').enabled if is_enabled: self.warning('The seed shutter is still enabled! Can not flip mirror!') return proxy = DeviceProxy('laser/ThorlabsMFF100/probe') proxy.Close() self.output("Probe mirror closed!")
def configure_sub(): configure_file = download_test_data( "low_configure_v1.json", "skampi-test-data/tmc-integration/configure") config = load_config_from_file(configure_file) os.remove(configure_file) SubarrayNodeLow = DeviceProxy('ska_low/tm_subarray_node/1') SubarrayNodeLow.Configure(config) LOGGER.info("Subarray obsState is: " + str(SubarrayNodeLow.obsState)) LOGGER.info('Invoked Configure on Subarray')
def configure(self, value): """Schedule an offline only SBI with SDP.""" # Only accept new SBIs if the SDP is on. if self._sdp_state.current_state != 'on': raise RuntimeWarning('Unable to configure SBIs unless SDP is ' '\'on\'.') # Check that the new SBI is not already registered. sbi_config_dict = json.loads(value) sbi_list = SchedulingBlockInstanceList() LOG.info('SBIs before: %s', sbi_list.active) if sbi_config_dict.get('id') in sbi_list.active: raise RuntimeWarning('Unable to add SBI with ID {}, an SBI with ' 'this ID is already registered with SDP!' .format(sbi_config_dict.get('id'))) # Add the SBI to the dictionary. LOG.info('Scheduling offline SBI! Config:\n%s', value) sbi = SchedulingBlockInstance.from_config(sbi_config_dict) LOG.info('SBIs after: %s', sbi_list.active) sbi_pb_ids = sbi.processing_block_ids LOG.info('SBI "%s" contains PBs: %s', sbi.id, sbi_pb_ids) # pb_list = ProcessingBlockList() # LOG.info('Active PBs: %s', pb_list.active) # Get the list and number of Tango PB devices tango_db = Database() pb_device_class = "ProcessingBlockDevice" pb_device_server_instance = "processing_block_ds/1" pb_devices = tango_db.get_device_name(pb_device_server_instance, pb_device_class) LOG.info('Number of PB devices in the pool = %d', len(pb_devices)) # Get a PB device which has not been assigned. for pb_id in sbi_pb_ids: for pb_device_name in pb_devices: device = DeviceProxy(pb_device_name) if not device.pb_id: LOG.info('Assigning PB device = %s to PB id = %s', pb_device_name, pb_id) # Set the device attribute 'pb_id' to the processing block # id it is tracking. device.pb_id = pb_id break
def lima_simulator(beacon): from Lima.Server.LimaCCDs import main from tango import DeviceProxy, DevFailed device_name = "id00/limaccds/simulator1" device_fqdn = "tango://localhost:12345/%s" % device_name p = subprocess.Popen(['LimaCCDs', 'simulator']) with gevent.Timeout(3, RuntimeError("Lima simulator is not running")): while True: try: dev_proxy = DeviceProxy(device_fqdn) dev_proxy.ping() dev_proxy.state() except DevFailed as e: gevent.sleep(0.5) else: break yield device_fqdn, dev_proxy p.terminate()
def bliss_tango_server(beacon): from tango import DeviceProxy, DevFailed device_name = "id00/bliss/test" device_fqdn = "tango://localhost:12345/%s" % device_name bliss_ds = [sys.executable, '-m', 'bliss.tango.servers.bliss_ds'] p = subprocess.Popen(bliss_ds+["test"]) with gevent.Timeout(3, RuntimeError("Bliss tango server is not running")): while True: try: dev_proxy = DeviceProxy(device_fqdn) dev_proxy.ping() dev_proxy.state() except DevFailed as e: gevent.sleep(0.5) else: break yield device_fqdn, dev_proxy p.terminate()
class SDPMasterDevice(Device): """SIP SDP Master device.""" _start_time = time.time() _service_state = ServiceState(__subsystem__, __service_name__, __version__) _sdp_state = SDPState() _devProxy = None # ------------------------------------------------------------------------- # General methods # ------------------------------------------------------------------------- def init_device(self): """Device constructor.""" Device.init_device(self) # Add anything here that has to be done before the device is set to # its ON state. self._set_master_state('on') self._devProxy = DeviceProxy(self.get_name()) # # Trying to add logging target in 'init_device' fails (BKMc) def always_executed_hook(self): """Run for each command.""" _logT = self._devProxy.get_logging_target() if 'device::sip_sdp_logger' not in _logT: try: self._devProxy.add_logging_target('device::sip_sdp/elt/logger') self.info_stream("Test of Tango logging from " "'tc_tango_master'") except Exception as e: LOG.debug('Failed to setup Tango logging %s', e ) def delete_device(self): """Device destructor.""" pass # ---------------dockj # Commands # --------------- @command(dtype_in=str) @DebugIt() def configure(self, value): """Schedule an offline only SBI with SDP.""" # Only accept new SBIs if the SDP is on. if self._sdp_state.current_state != 'on': raise RuntimeWarning('Unable to configure SBIs unless SDP is ' '\'on\'.') # Check that the new SBI is not already registered. sbi_config_dict = json.loads(value) sbi_list = SchedulingBlockInstanceList() LOG.info('SBIs before: %s', sbi_list.active) if sbi_config_dict.get('id') in sbi_list.active: raise RuntimeWarning('Unable to add SBI with ID {}, an SBI with ' 'this ID is already registered with SDP!' .format(sbi_config_dict.get('id'))) # Add the SBI to the dictionary. LOG.info('Scheduling offline SBI! Config:\n%s', value) sbi = SchedulingBlockInstance.from_config(sbi_config_dict) LOG.info('SBIs after: %s', sbi_list.active) sbi_pb_ids = sbi.processing_block_ids LOG.info('SBI "%s" contains PBs: %s', sbi.id, sbi_pb_ids) # pb_list = ProcessingBlockList() # LOG.info('Active PBs: %s', pb_list.active) # Get the list and number of Tango PB devices tango_db = Database() pb_device_class = "ProcessingBlockDevice" pb_device_server_instance = "processing_block_ds/1" pb_devices = tango_db.get_device_name(pb_device_server_instance, pb_device_class) LOG.info('Number of PB devices in the pool = %d', len(pb_devices)) # Get a PB device which has not been assigned. for pb_id in sbi_pb_ids: for pb_device_name in pb_devices: device = DeviceProxy(pb_device_name) if not device.pb_id: LOG.info('Assigning PB device = %s to PB id = %s', pb_device_name, pb_id) # Set the device attribute 'pb_id' to the processing block # id it is tracking. device.pb_id = pb_id break @staticmethod def _get_service_state(service_id: str): """Get the Service state object for the specified id.""" LOG.debug('Getting state of service %s', service_id) services = get_service_id_list() service_ids = [s for s in services if service_id in s] if len(service_ids) != 1: return 'Service not found! services = {}'.format(str(services)) subsystem, name, version = service_ids[0].split(':') return ServiceState(subsystem, name, version) @command(dtype_in=str, dtype_out=str) @DebugIt() def get_current_service_state(self, service_id: str): """Get the state of a SDP service.""" state = self._get_service_state(service_id) return state.current_state @command(dtype_in=str, dtype_out=str) @DebugIt() def get_target_service_state(self, service_id: str): """Get the state of a SDP service.""" state = self._get_service_state(service_id) return state.target_state # ------------------ # Attributes methods # ------------------ @attribute(dtype=str) def version(self): """Return the version of the Master Controller Device.""" return __version__ @attribute(dtype=str) def sdp_services(self): """Return list of SDP services.""" services = get_service_state_list() return str(services) @attribute(dtype=str) def current_sdp_state(self): """Return the current state of the SDP.""" return self._sdp_state.current_state @attribute(label="Target", dtype=str) def target_sdp_state(self): """Return the target state of SDP.""" return self._sdp_state.target_state @attribute(dtype=str) def allowed_target_sdp_states(self): """Return a list of allowed target states for the current state.""" _current_state = self._sdp_state.current_state _allowed_target_states = self._sdp_state.allowed_target_states[ _current_state] return json.dumps(dict(allowed_target_sdp_states= _allowed_target_states)) @target_sdp_state.write def target_sdp_state(self, state): """Update the target state of SDP.""" LOG.info('Setting SDP target state to %s', state) if self._sdp_state.current_state == state: LOG.info('Target state ignored, SDP is already "%s"!', state) if state == 'on': self.set_state(DevState.ON) if state == 'off': self.set_state(DevState.OFF) if state == 'standby': self.set_state(DevState.STANDBY) if state == 'disable': self.set_state(DevState.DISABLE) self._sdp_state.update_target_state(state) @attribute(dtype=str) @DebugIt() def health(self): """Health check method, returns the up-time of the device.""" return json.dumps(dict(uptime='{:.3f}s' .format((time.time() - self._start_time)))) @attribute(dtype=str) def resource_availability(self): """Return the a JSON dict describing the SDP resource availability.""" return json.dumps(dict(nodes_free=randrange(1, 500))) # @pipe # def resource_availability(self): # """Return the a dict describing the SDP resource availability.""" # return 'resource_availability', dict(nodes_free=randrange(1, 500)) @attribute(dtype=str) def scheduling_block_instances(self): """Return the a JSON dict encoding the SBIs known to SDP.""" # TODO(BMo) change this to a pipe? sbi_list = SchedulingBlockInstanceList() return json.dumps(dict(active=sbi_list.active, completed=sbi_list.completed, aborted=sbi_list.aborted)) @attribute(dtype=str) def processing_blocks(self): """Return the a JSON dict encoding the PBs known to SDP.""" pb_list = ProcessingBlockList() # TODO(BMo) realtime, offline etc. return json.dumps(dict(active=pb_list.active, completed=pb_list.completed, aborted=pb_list.aborted)) @attribute(dtype=str) def processing_block_devices(self): """Get list of processing block devices.""" # Get the list and number of Tango PB devices tango_db = Database() pb_device_class = "ProcessingBlockDevice" pb_device_server_instance = "processing_block_ds/1" pb_devices = tango_db.get_device_name(pb_device_server_instance, pb_device_class) LOG.info('Number of PB devices in the pool = %d', len(pb_devices)) pb_device_map = [] for pb_device_name in pb_devices: device = DeviceProxy(pb_device_name) if device.pb_id: LOG.info('%s %s', pb_device_name, device.pb_id) pb_device_map.append((pb_device_name, device.pb_id)) return str(pb_device_map) def _set_master_state(self, state): """Set the state of the SDPMaster.""" if state == 'init': self._service_state.update_current_state('init', force=True) self.set_state(DevState.INIT) elif state == 'on': self.set_state(DevState.ON) self._service_state.update_current_state('on')
# coding=utf-8 """Module to get tango device variables.""" import logging from sip_logging import init_logger from tango import DeviceProxy init_logger() log = logging.getLogger('sip.itango_utils.get_tango_devices') device_name = 'sip_sdp/elt/master' log.info('* Getting Tango Master Device (%s) as: \'md\'', device_name) md = DeviceProxy(device_name) log.info(' - Tango Master Device version: %s, status: %s', md.version, md.status()) log.info('* Tango Master Device attributes:') for attr in md.get_attribute_list(): log.info(' - %s', attr) log.info('* Tango Master Device commands:') for cmd in md.get_command_list(): log.info(' - %s', cmd) sub = [] for index in range(2): device_name = 'sip_sdp/elt/subarray_{:02d}'.format(index) log.info('* Getting Subarray %02d Device (%s) as: \'sub[%02d]\'', index, device_name, index) device = DeviceProxy(device_name) # sub.append(DeviceProxy('sip_sdp/elt/subarray_%02d'.format(index))) # log.info(' - Subarray %02d Device version: %s, status: %s', # sub[index].version, sub[index].status())
from sip_logging import init_logger init_logger() log = logging.getLogger('sip.itango_utils.load_sbi_config') call(["skasip_config_db_register_workflows", "./data/workflows"]) call(["skasip_config_db_workflow_definitions"]) sbi_config_file = join('data', 'sbi_config.json') log.info('* Loading: %s', sbi_config_file) with open(sbi_config_file, 'r') as file: sbi_config_str = file.read() sbi_config_dict = json.loads(sbi_config_str) log.info('* File loaded as: \'sbi_config_dict\'') md = DeviceProxy('sip_sdp/elt/master') md.target_sdp_state = 'on' while md.current_sdp_state != 'on': time.sleep(0.1) if md.current_sdp_state == 'on': print(md.name(), md.version) sbi_ids = json.loads(md.scheduling_block_instances).get('active') print(sbi_ids) pb_ids = json.loads(md.processing_blocks).get('active') print(pb_ids) if sbi_ids: num_sbis = len(sbi_ids)