class Server(BaseRepresentation): #-------------------------------------------------------------------------- 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
class Server(BaseRepresentation): #-------------------------------------------------------------------------- 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
This method is overriden to do something useful once a timeout occurs ''' print "The current time is: ", e.value #--------------------------------------------------- # Make an instance of the PySimpleClient simpleClient = PySimpleClient() # Get the current time from the standard CLOCK1 Clock device and add 3 seconds to it # This is when the timeout will occur. start = long(getTimeStamp().value) + long(30000000) # Get the standard Timer component which will # schedule the timeout timer = simpleClient.getDefaultComponent("IDL:alma/acstime/Timer:1.0") # Create timeout handler and schedule its timeout myHandler = TimeoutHandlerImpl() myHandler2 = TimeoutHandlerImpl() # A Duration of 0 implies the timeout will only occur once id1 = timer.schedule(simpleClient.activateOffShoot(myHandler), acstime.Epoch(start), acstime.Duration(long(20000000))) # A Duration of 0 implies the timeout will only occur once id2 = timer.schedule(simpleClient.activateOffShoot(myHandler2), acstime.Epoch(start), acstime.Duration(long(0)))
#!/usr/bin/env python from Acspy.Clients.SimpleClient import PySimpleClient import APDMEntities.SchedBlock import sys, traceback import pyxb pyxb.namespace.builtin.XMLSchema_instance.ProcessTypeAttribute(pyxb.namespace.builtin.XMLSchema_instance.PT_skip) pyxb.RequireValidWhenParsing(False) if len(sys.argv) < 2: print "Nothing to do. This script requires as arguments SB uids" exit() client = PySimpleClient() stateSystem = client.getDefaultComponent("IDL:alma/projectlifecycle/StateSystem:1.0") archive = client.getDefaultComponent("IDL:alma/xmlstore/ArchiveConnection:1.0") ops = archive.getOperational("SCRIPT") for uid in sys.argv[1:]: print "Trying to transition SB with UID:", uid xml = ops.retrieve(uid) sb = APDMEntities.SchedBlock.CreateFromDocument(xml.xmlString) sbs_id = sb.SBStatusRef.entityId try: # First try with CSV SB # stateSystem.changeSBStatus(str(sbs_id), 'Running', 'scheduling', 'user_with_all_roles') # stateSystem.changeSBStatus(str(sbs_id), 'CSVReady', 'scheduling', 'aod') stateSystem.changeSBStatus(str(sbs_id), "CSVReady", "scheduling", "user_with_all_roles") except: # Then with a Regular SB