Skip to content
Snippets Groups Projects
Select Git revision
  • 289d18c60dbcf63e3cc0dac8c9c48d899cc20d39
  • master default protected
  • test-pytango-10.0.3
  • revert-cs032-ccd-ip
  • deploy-components-parallel
  • fix-chrony-exporter
  • L2SS-2407-swap-iers-caltable-monitoring-port
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • all-stations-lofar2
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • L2SS-2129-Add-Subrack-Routine
  • Also-listen-internal-to-rpc
  • v0.55.5-r2 protected
  • v0.52.8-rc1 protected
  • v0.55.5 protected
  • v0.55.4 protected
  • 0.55.2.dev0
  • 0.55.1.dev0
  • 0.55.0.dev0
  • v0.54.0 protected
  • 0.53.2.dev0
  • 0.53.1.dev0
  • v0.52.3-r2 protected
  • remove-snmp-client
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
41 results

startup.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    startup.py 1.42 KiB
    #! /usr/bin/env python3
    
    
    def startup(device: str, force_restart: bool):
        '''
        Start a LOFAR Tango device:
        pcc = startup(device = 'LTS/PCC/1', force_restart = False)
        '''
        import tango
        proxy = tango.DeviceProxy(device)
        state = proxy.state()
    
        if force_restart is True:
            print("Forcing device {} restart.".format(device))
            proxy.off()
            state = proxy.state()
            if state is not tango._tango.DevState.OFF:
                print("Device {} cannot perform off although restart has been enforced, state = {}.  Please investigate.".format(device, state))
                return proxy
        if state is not tango._tango.DevState.OFF:
            print("Device {} is not in OFF state, cannot start it.  state = {}".format(device, state))
            return proxy
        print("Device {} is in OFF, performing initialisation.".format(device))
        proxy.initialise()
        state = proxy.state()
        if state is not tango._tango.DevState.STANDBY:
            print("Device {} cannot perform initialise, state = {}.  Please investigate.".format(device, state))
            return proxy
        print("Device {} is in STANDBY, performing on.".format(device))
        proxy.on()
        state = proxy.state()
        if state is not tango._tango.DevState.ON:
            print("Device {} cannot perform on, state = {}.  Please investigate.".format(device, state))
        else:
            print("Device {} has successfully reached ON state.".format(device))
        return proxy