本文整理汇总了Python中Acspy.Clients.SimpleClient.PySimpleClient类的典型用法代码示例。如果您正苦于以下问题:Python PySimpleClient类的具体用法?Python PySimpleClient怎么用?Python PySimpleClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PySimpleClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestStorageMethods
class TestStorageMethods(unittest.TestCase):
def test_full(self):
self.client = PySimpleClient()
self.storage = self.client.getComponent("STORAGE")
self.storage.clearAllData()
targets = []
images = []
for i in range(10):
targets.append(TYPES.Target(i, TYPES.Position(10.0, 45.0), 2))
image = bytearray()
for j in range(1000000):
image.append(j % 256)
images.append(bytes(image))
proposal = TYPES.Proposal(0, targets, 0)
self.storage.storeObservation(proposal, images)
id = self.storage.getNextValidId()
print "ID", id
self.assertEqual(1, id, "Checking ID")
result = self.storage.getObservation(0)
self.assertEqual(10, len(result), "Number of observations")
self.storage.clearAllData()
self.client.releaseComponent(self.storage._get_name())
示例2: set_array_frec
def set_array_frec():
client = PySimpleClient()
master = client.getComponent("CONTROL/MASTER")
arrayList = master.getAutomaticArrayComponents() + master.getManualArrayComponents()
for array in arrayList:
master.destroyArray(array.ComponentName)
arrayList = []
antennas = master.getAvailableAntennas()
master.createManualArray(antennas)
arrayList = master.getAutomaticArrayComponents() + master.getManualArrayComponents()
if ( arrayList != 1 ):
if( len(arrayList) == 0):
print "Could not create an array!!"
client.releaseComponent("CONTROL/MASTER")
sys.exit(0)
else:
print "Could not destroy previosly arrays and create a new fresh array!"
client.releaseComponent("CONTROL/MASTER")
sys.exist(0)
currentArray = client.getComponent(arrayList[0].ComponentName)
client.releaseComponent("CONTROL/MASTER")
setArrayName(currentArray.getArrayName())
array = getArray()
tp = array.getTotalPowerObservingMode()
return tp
示例3: subsystemsOffline
def subsystemsOffline(self, subsystem):
from Acspy.Clients.SimpleClient import PySimpleClient
client = PySimpleClient()
mcI = client._ContainerServices__importComponentStubs(comp_type="IDL:alma/ACS/MasterComponent:1.0")
subsystem = client.getComponent(subsystem)
subsystem.doTransition(mcI.SUBSYSEVENT_SHUTDOWNPASS1)
(state, flag) = self.__waitForSubsystemState(subsystem._get_currentStateHierarchy(), "AVAILABLE.OFFLINE.PRESHUTDOWN", 300)
if flag is False:
return (state, flag)
subsystem.doTransition(mcI.SUBSYSEVENT_SHUTDOWNPASS2)
(state, flag) = self.__waitForSubsystemState(subsystem._get_currentStateHierarchy(), "AVAILABLE.OFFLINE.SHUTDOWN", 300)
if flag is False:
return (state, flag)
return (state, flag)
示例4: __init__
def __init__(self):
try:
#This stuff is only for get the antennas of a manual array
from Acspy.Clients.SimpleClient import PySimpleClient
c = PySimpleClient()
master = c.getComponent('CONTROL/MASTER')
arrayname = master.getManualArrays()
array = c.getComponent('CONTROL/'+arrayname[0])
self.antennalist = array.getAntennas()
self.logger = getLogger()
del master
del array
c.disconnect()
except Exception, e:
print e
示例5: setUp
def setUp(self):
"""
Test case fixture.
"""
self.client = PySimpleClient("ServerRepresentationTest")
self.simulator = self.client.getComponent("SIMULATION_SERVER")
self.lamp = self.client.getComponent("LAMP_ACCESS")
示例6: checkOnline
def checkOnline(self):
masters_states = []
from Acspy.Clients.SimpleClient import PySimpleClient
masters_comps = self.parser.get_masters_from_execconfig()
for master in masters_comps:
client = PySimpleClient()
subsystem = client.getComponent(master)
currentStateHierarchy = subsystem._get_currentStateHierarchy()
state = currentStateHierarchy.get_sync()
#if (state[0][1] is 'OPERATIONAL'):
masters_states.append([master,state[0][1]])
for state in masters_states:
if(state[1] == 'OPERATIONAL'):
print state
pass
else:
return state
return "OK"
示例7: EventSubscriberImplTestPy
class EventSubscriberImplTestPy(unittest.TestCase):
################################################
# lifecycle
################################################
def setUp(self):
self.simpleClient = PySimpleClient()
self.componentName = "testInstanceEventSubscriberImpl"
self.simpleClient.getLogger().logInfo("pyUnitTestEventSubscriberImpl.EventSubscriberImplTestPy.setUp()...")
self.simpleClient.getLogger().logInfo("Get component " + self.componentName)
self.component = self.simpleClient.getComponent(self.componentName)
#__pPp__
def tearDown(self):
self.simpleClient.getLogger().logInfo("pyUnitTestEventSubscriberImpl.EventSubscriberImplTestPy.tearDown()...")
self.simpleClient.getLogger().logInfo("Releasing component " + self.componentName)
self.simpleClient.releaseComponent(self.componentName)
self.simpleClient.disconnect()
示例8: run
def run(self):
self.simpleClient = PySimpleClient.getInstance()
self.ccinstance = self.simpleClient.getDefaultComponent("IDL:alma/CSATCONTROL_MODULE/CSATControl:1.0")
self.csinstance = self.simpleClient.getDefaultComponent("IDL:alma/CSATSTATUS_MODULE/CSATStatus:1.0")
self.cupd = coorUpdater(self.ra,self.dec,self.csinstance)
self.iupd = imgUpdater(self.img,self.ccinstance)
self.csinstance.on()
self.cupd.start()
if(self.video):
self.iupd.start()
gtk.main()
示例9: __init__
def __init__(self, compname, comp_type):
BaseRepresentation.__init__(self, compname)
self.comp_type = comp_type
self.simulator = None
self.client = PySimpleClient()
self.simulator = None
try:
self.simulator = self.client.getDefaultComponent("IDL:alma/ACSSim/Simulator:1.0")
except NoDefaultComponentEx, ex:
# fine, no Simulator Server component defined in the CDB
pass
示例10: get_mgr_instance
def get_mgr_instance(self,antenna):
'''
Get dinamic component instance
'''
from Acspy.Clients.SimpleClient import PySimpleClient
mgr = None
sys.stdout = open("/dev/null", "w")
client = PySimpleClient("CAN STATUS")
sys.stdout = sys.__stdout__
deployed_mgrs = client.availableComponents(type_wildcard='IDL:alma/Control/AmbManager:1.0')
for deployed_mgr in deployed_mgrs:
if deployed_mgr.name.__contains__(antenna) :
print "Trying to get ambManager from %s" % antenna
try:
mgr= client.getDynamicComponent(deployed_mgr.name, deployed_mgr.type, deployed_mgr.code, deployed_mgr.container_name)
except maciErrType.CannotGetComponentEx, e:
print e[0].shortDescription
sys.exit(-1)
except Exception, e:
print e
sys.exit(-1)
break
示例11: mostRecentAsdm
def mostRecentAsdm(date=None) :
if date == None :
date='%4.2d-%2.2d-%2.2d'%(time.gmtime()[0], time.gmtime()[1], time.gmtime()[2])
client = PySimpleClient()
archConn = client.getComponent('ARCHIVE_CONNECTION')
archOp = archConn.getOperational('XMLQueryTest')
uids = archOp.queryRecent('ASDM',date+'T00:00:00.000')
asdm_name=[]
for uid in uids:
result = archOp.retrieveDirty(uid)
dataSet = ArchivedAsdm(result.xmlString)
dateOfCreation = dataSet.getDateOfCreation()
if dataSet.isAsdm() & (dateOfCreation==date):
asdm_name.append("%s \t%s" % (dateOfCreation,uid))
asdm_name.sort()
client.releaseComponent('ARCHIVE_CONNECTION')
client.disconnect()
if len(asdm_name) == 0 :
print 'there are no asdms for %s' % date
return None
else :
return asdm_name[-1].split('\t')[1]
示例12: mostRecentAsdm
def mostRecentAsdm(date = None):
'''
Get the most recent Asdm, given a date.
If the date is None, it takes the actual hour.
return asdm or None
'''
from Acspy.Clients.SimpleClient import PySimpleClient
from ArchivedAsdm import ArchivedAsdm
if date == None :
date_T = '%4.2d-%2.2d-%2.2dT00:00:00.000' % (gmtime()[0] , gmtime()[1] , gmtime()[2])
date = '%4.2d-%2.2d-%2.2d'% (gmtime()[0] , gmtime()[1] , gmtime()[2])
else:
date_T = '%4.2d-%2.2d-%2.2dT%2.2d:00:00.00' % (date[0] , date[1] , date[2] , date[3])
date = '%4.2d-%2.2d-%2.2d'% (date[0] , date[1] , date[2])
client = PySimpleClient()
archConn = client.getComponent('ARCHIVE_CONNECTION')
archOp = archConn.getOperational('XMLQueryTest')
uids = archOp.queryRecent('ASDM' , date_T)
print "Connection entablish with archive ..."
asdm_name = []
for uid in uids:
print "Checking date of " +str(uid),
result = archOp.retrieveDirty(uid)
dataSet = ArchivedAsdm(result.xmlString)
dateOfCreation = dataSet.getDateOfCreation()
print " created: "+str(dataSet.getDateTimeOfCreation()),
if dataSet.isAsdm() & (dateOfCreation==date):
asdm_name.append("%s \t%s" % (dataSet.getDateTimeOfCreation() , uid))
print " --> is an asdm!",
print ""
asdm_name.sort()
client.releaseComponent('ARCHIVE_CONNECTION')
client.disconnect()
if len(asdm_name) == 0 :
print 'There are no asdms for %s' % date
return None
else :
return asdm_name[-1].split('\t')[1]
示例13: PySimpleClient
parser.add_option("--levelMax", dest="levelMax", type=float, default=5.0,
help="White level in dBm for when not using fullscale option [default 5.0] (note optimal levels for TDM and FDM observations are 3.8 and 2.4 dBm respectively, so if you go below these expect to white-out a lot!)")
parser.add_option("--levelMin", dest="levelMin", type=float, default=-2.0,
help="Black level in dBm for when not using fullscale option [default -2.0]")
(options, args) = parser.parse_args()
print 'finding configured antennas'
# get_configured_antennas:
if options.antennaList == 'All':
from Acspy.Clients.SimpleClient import PySimpleClient
client = PySimpleClient("ping_abm")
ant_info = client.availableComponents(type_wildcard='IDL:alma/Control/Antenna:1.0', activated=1)
availableAnts = []
notAvailableAntennas = []
if len(ant_info) > 0:
for antenna_info in ant_info:
try:
name = antenna_info.name
antenna = client.getComponentNonSticky(antenna_info.name)
name.split('/')
antName = name.split('/')[1]
sys.stdout.write(antName+'\r')
# sys.stdout.flush()
print antName
if str(antenna.getState())=="Shutdown":
notAvailableAntennas.append(antenna[1])
示例14: PySimpleClient
import sys
import time
from Acspy.Clients.SimpleClient import PySimpleClient
remoteComponentName = "TESTMAXMSGSIZE"
# Loop and call the sendSequence method on the component
# making the size of the sequence sent larger w/ each iteration
# at some point, the ORB should fail because omniorb's max
# msg size will have been exceeded.
# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()
while 1:
try:
characters = "1"
# Get the test component by name
remoteComponent = simpleClient.getComponent(remoteComponentName)
for i in range(0, 22):
print "Length being sent: ", len(characters)
remoteComponent.sendSequence(characters)
characters = characters + characters
simpleClient.releaseComponent(remoteComponentName)
except:
print "FAILED to send: ", len(characters)
time.sleep(1)
示例15: PySimpleClient
# MA 02111-1307 USA
#
from Acspy.Clients.SimpleClient import PySimpleClient
from sys import argv
from sys import exit
from sys import stdout
from TMCDB import MonitorCollector
from TMCDB import propertySerailNumber
from omniORB import any
import MonitorErrImpl
import MonitorErr
import time
# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()
mc = simpleClient.getComponent(argv[1])
try:
tc = simpleClient.getComponent('MC_TEST_PROPERTIES_COMPONENT')
psns =[propertySerailNumber('doubleROProp', ['1' ]),
propertySerailNumber('floatROProp', ['2' ]),
propertySerailNumber('longROProp', ['3' ]),
propertySerailNumber('uLongROProp', ['4' ]),
propertySerailNumber('patternROProp', ['5' ]),
propertySerailNumber('stringROProp', ['6' ]),
propertySerailNumber('longLongROProp', ['7' ]),
propertySerailNumber('uLongLongROProp', ['8' ]),
propertySerailNumber('booleanROProp', ['9' ]),
propertySerailNumber('doubleSeqROProp', ['10']),