Ejemplo n.º 1
0
    def __init__(self, property_name, backend_buffer, logger=None):
        """
        Constructor.

        @param property_name: Propoerty name for the callback
        @type property_name: string
        @param backend_buffer: buffer from the backend registry
        @type backend_buffer:
            ctamonitoring.property_recorder.backend.dummy.registry.Buffer

        @raise ValueError: if no name is given to the property
            or no buffer is specified
        """

        # If there is no name then we do not want to store anything
        if property_name is not None:
            self.property_name = property_name
        else:
            raise ValueError("no name was given to the property")

        # collection where the data should be stored. Expected:
        # deque type. If none is provided, the only local storage is performed
        if backend_buffer is None:
            raise ValueError("no archive buffer was provided")
        else:
            self.backend_buffer = backend_buffer

        if logger is None:
            logger = getLogger('ctamonitoring.property_recorder.callbacks')

        self._logger = logger

        # Flag for the application to check if the action is still going on
        # and if the callback has arrived.
        self.status = 'INIT'
Ejemplo n.º 2
0
    def __init__(self, channelname, component=None, domain=None):
        '''
        Constructor.

        Params:
        - channelName is the channel name
        - component is the component this supplier has been instantiated from
        (if applicable). This parameter is likely to become mandatory in future
        version of ACS
        - domain is the name of the domain of notification channels the channel
        belongs to


        Returns: Nothing

        Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
        '''

        #Logger for this supplier
        self.logger = getLogger(str(channelname) + "-Supplier")

        #Call the super's constructor
        CommonNC.__init__(self, channelname, component, domain)

        #CORBA ref to the channels supplier admin
        self.supplierAdmin = None
        #CORBA ref to this suppliers structured proxy push consumer
        self.sppc = None
        #number of events sent so far
        self.count = 0

        #Handle all of the CORBA stuff now
        CommonNC.initCORBA(self)
        self.initCORBA()
Ejemplo n.º 3
0
    def __init__(self, comp_ref):
        '''
        Constructor
        
        Parameters: comp_ref - reference to the component
        
        Raises: ???
        '''
        #component reference
        self.comp_ref = comp_ref

        #the component's name which we need for the CDB
        self.comp_name = self.comp_ref._get_name()

        #our own personal logger
        self.logger = getLogger("EventDispatcher (" + self.comp_name + ")")

        #list of all timeouts we have scheduled. used at destruction
        self.timeout_ids = []

        #maps consumer objects to channels.
        self.consumers = {}

        #delegate the logic determining when events will be sent
        #to this helper method
        self.setupEventDispatching()
Ejemplo n.º 4
0
    def __init__(self, backends, strict=False, log=None, *args, **kwargs):
        """
        ctor.

        @param backends: This is a list of backend names and configurations.
        The actual backends are created using:
        get_registry_class(name)(**config)
        @type backends: list of (string, dict) pairs
        @param strict: Simple fork may raise an exception if
        a buffer operation such as add fails. A strict buffer raises
        an exception already if the operation fails at one and more childs.
        A "lazy" buffer only raises an exception if the operation fails
        at every child.
        Optional, default is False.
        @type strict: boolean
        @param log: An external logger to write log messages to.
        Optional, default is None.
        @type log: logging.Logger
        """
        super(Registry, self).__init__(log, *args, **kwargs)
        if not self._log:
            self._log = getLogger(defaultname)
        self._log.debug("creating a simple fork registry")
        self._strict = strict
        self._registries = []
        for backend_name, backend_config in backends:
            self._log.info("create registry %s" % (backend_name,))
            try:
                r = get_registry_class(backend_name)
                self._registries.append((backend_name, r(**backend_config)))
            except:
                self._log.exception("cannot create registry %s" %
                                    (backend_name,))
                del self._registries
                raise
Ejemplo n.º 5
0
    def __init__(self, name="Python Client"):
        '''
        Initialize the client.

        Parameters:
        - name is what manager will refer to this client instance as

        Returns: Nothing

        Raises: CORBAProblemExImpl
        '''
        
        #security token given to us by the manager
        self.token = None
        #name we will call ourself when contacting the manager
        self.name = str(name)
        #Logger used by container/components
        try:
            self.logger
        except:
            self.logger = getLogger(name)
        startPeriodicFlush(3)
        #List of components manager says are active
        self.managerComponents = []
        #CORBA reference to ourself
        self.corbaRef = None
        
        try:
            #get our token from manager
            self.token = getManager().login(self.getMyCorbaRef())
        except Exception, e:
            #cannot go on if the login fails
            print_exc()
            raise CORBAProblemExImpl()
Ejemplo n.º 6
0
    def get_callback(prop, prop_name, monitor_buffer, logger=None):
        """
        Static factory method that returns the callback adequate to
        the property

        @param prop: ACS property to monitor
        @type prop: ACS._objref_<property_type>
        @param monitor_buffer: buffer object from the backends types
        @type: ctamonitoring.property_recorder.backend.dummy.registry.Buffer
        @raise UnsupporterPropertyTypeError: If the property type
                                             is not supported
        @param logger ACS logger
        @type Acspy.Common.Log.Logger
        """
        if logger is None:
            logger = getLogger('ctamonitoring.property_recorder.callbacks')
        try:
            if CBFactory.__cbMap[prop._NP_RepositoryId] is None:
                raise UnsupporterPropertyTypeError(prop._NP_RepositoryId)
            else:
                return (CBFactory.__cbMap[prop._NP_RepositoryId](
                    prop_name, monitor_buffer, logger))
        # If key error, then it is probably an enum
        except KeyError:
            logger.debug("no NP_RepositoryID, "
                         "property type candidate: enum")
            return (ArchCBpatternValueRep(prop_name, monitor_buffer, logger))
Ejemplo n.º 7
0
    def __init__(self, compname, supported_interfaces):
        '''
        Constructor.

        Paramters:
        - compname is the name of the component being simulated
        - supported_interfaces is an optional list of IDL interfaces which 
        this particular component supports.
        
        Returns: Nothing

        Raises: ???
        '''
        #superclass constructor
        BaseRepresentation.__init__(self, compname)

        #setup the logger
        self.__logger = getLogger(str(CDB) + "(" + compname + ")")

        #bool value showing whether the CDB entry exists or not
        self.exists = 0

        #determine if this simulated component allows inheritence
        allows_inheritence = self.handleCDB(compname)

        if allows_inheritence:
            #look at all supported IDL interfaces first
            self.handleInterfaces(supported_interfaces)

        #add this individual component one more time to override
        #anything defined in the subinterfaces. this is necessary if
        #the component is of type IDL:alma/x/y:1.0 and this entry
        #exists in the CDB
        self.handleCDB(compname)
Ejemplo n.º 8
0
 def __init__(self, comp_ref):
     '''
     Constructor
     
     Parameters: comp_ref - reference to the component
     
     Raises: ???
     '''
     #component reference
     self.comp_ref = comp_ref
     
     #the component's name which we need for the CDB
     self.comp_name = self.comp_ref._get_name()
     
     #our own personal logger
     self.logger = getLogger("EventDispatcher (" + 
                              self.comp_name + ")")
     
     #list of all timeouts we have scheduled. used at destruction
     self.timeout_ids = []
     
     #maps consumer objects to channels.
     self.consumers = {}
     
     #delegate the logic determining when events will be sent
     #to this helper method
     self.setupEventDispatching()
Ejemplo n.º 9
0
    def __init__ (self, compname, supported_interfaces):
        '''
        Constructor.

        Paramters:
        - compname is the name of the component being simulated
        - supported_interfaces is an optional list of IDL interfaces which 
        this particular component supports.
        
        Returns: Nothing

        Raises: ???
        '''
        #superclass constructor
        BaseRepresentation.__init__(self, compname)
        
        #setup the logger
        self.__logger = getLogger(str(CDB) + "(" + compname + ")")
        
        #bool value showing whether the CDB entry exists or not
        self.exists=0
        
        #determine if this simulated component allows inheritence
        allows_inheritence = self.handleCDB(compname)
        
        if allows_inheritence:
            #look at all supported IDL interfaces first
            self.handleInterfaces(supported_interfaces)
            
        #add this individual component one more time to override
        #anything defined in the subinterfaces. this is necessary if
        #the component is of type IDL:alma/x/y:1.0 and this entry
        #exists in the CDB
        self.handleCDB(compname)
Ejemplo n.º 10
0
    def __init__ (self, channelname, component=None, domain=None):
        '''
        Constructor.

        Params:
        - channelName is the channel name
        - component is the component this supplier has been instantiated from
        (if applicable). This parameter is likely to become mandatory in future
        version of ACS
        - domain is the name of the domain of notification channels the channel
        belongs to


        Returns: Nothing

        Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
        '''
        
        #Logger for this supplier
        self.logger = getLogger(str(channelname) + "-Supplier")

        #Call the super's constructor
        CommonNC.__init__(self, channelname, component, domain)
        
        #CORBA ref to the channels supplier admin
        self.supplierAdmin = None  
        #CORBA ref to this suppliers structured proxy push consumer
        self.sppc = None
        #number of events sent so far
        self.count = 0

        #Handle all of the CORBA stuff now
        CommonNC.initCORBA(self)
        self.initCORBA()
Ejemplo n.º 11
0
    def __init__(self):
        '''
        Just call superclass constructors here.
        '''
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)

        self.LOGGER = getLogger("CounterSupplier")
        #LOGGER.logInfo('Passed through __init__')
        return
Ejemplo n.º 12
0
    def __init__(self):
        '''
        Just call superclass constructors here.
        '''
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)

        self.LOGGER = getLogger("CounterSupplier")
        #LOGGER.logInfo('Passed through __init__')
        return
Ejemplo n.º 13
0
    def __init__(self, log=None, *args, **kwargs):
        """
        ctor.

        @param log: An external logger to write log messages to.
        Optional, default is None.
        """
        super(Registry, self).__init__(log, *args, **kwargs)
        if not self._log:
            self._log = getLogger(defaultname)
        self._log.debug("creating a log registry")
Ejemplo n.º 14
0
    def __init__(self):
        '''
        Just call superclass constructors here.
        '''
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)

        self.eventCount = 0
        self.contFlag = True
        self.LOGGER = getLogger("CounterConsumer")

        return
Ejemplo n.º 15
0
    def __init__(self):
        '''
        Just call superclass constructors here.
        '''
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)

        self.eventCount = 0
        self.contFlag = True
        self.LOGGER = getLogger("CounterConsumer")

        return
Ejemplo n.º 16
0
    def getLogger(self):
        '''
        Returns the component/client logger.

        Parameters: None

        Return: a logger

        Raises: Nothing
        '''
        if not self.__logger:
            self.__logger = getLogger(self.__name)
        return self.__logger
Ejemplo n.º 17
0
    def getLogger(self):
        '''
        Returns the component/client logger.

        Parameters: None

        Return: a logger

        Raises: Nothing
        '''
        if not self.__logger:
            self.__logger = getLogger(self.__name)
        return self.__logger
Ejemplo n.º 18
0
    def __init__ (self, name, component=None, domain=None):
        '''
        Constructor.

        Params:
        - name is the channel name in string format
        - component is the component this supplier has been instantiated from
        (if applicable). This parameter is likely to become mandatory in future
        version of ACS
        - domain is the name of the domain of notification channels the channel
        belongs to

        Returns: Nothing

        Raises: ACSErrTypeCommonImpl.CORBAProblemExImpl on critical failures
        '''
        self.logger = getLogger(str(name) + "-Consumer")

        #Call the super's constructor
        CommonNC.__init__(self, name, component, domain)
        
        #CORBA ref to the channels consumer admin
        self.consumerAdmin = None  
        #CORBA ref to this consumers structured proxy push supplier
        self.spps = None
        #Dictionary containing handler functions for different object types
        self.handlers = {}
        #dictionary mapping events to the total amount of time they have
        #to finish
        self.handlerTimeoutDict = getEventHandlerTimeoutDict(name)
        #profiler to time how long it takes events to be processed
        self.profiler = Profiler()
        #Is the consumer suspended?
        self.suspended = False
        #Lock used to read & write suspended attribute
        self.lockAction = threading.Lock()
       
        #Handle all of the CORBA stuff now
        CommonNC.initCORBA(self)
        self.initCORBA()
        self.__buffer_max_size = 100
        self.__buffer = Queue.Queue(self.__buffer_max_size);
        self.__stop_thread = False
        self.__thread = Thread(target=self.__process_event)
        self.__thread.setDaemon(True)
        self.__thread.start()
Ejemplo n.º 19
0
    def __init__ (self, compname, comptype):
        '''
        Constructor
        '''
        #superclass constructor
        BaseRepresentation.__init__(self, compname)
        
        self.__logger = getLogger(str(Dynamic) + "(" + compname + ")")

        #---------------------------------------------------------------------
        def __initialize(args):
            '''
            Fake lifecycle method.
            '''
            self.__logger.logDebug("Simulated lifecyle method")
            return
    
        def __cleanUp(args):
            '''
            Fake lifecycle method.
            '''
            self.__logger.logDebug("Simulated lifecyle method")
            return
        
        self.setMethod('initialize',
                        {'Timeout' : 0.0,
                          'Value' : __initialize}
                       )
        
        self.setMethod('cleanUp',
                        {'Timeout' : 0.0,
                          'Value' : __cleanUp}
                       )

        #save the IDL type
        self.comp_type = comptype

        self.__interf = IR.lookup_id(comptype)
        try:
            self.__interf = self.__interf._narrow(CORBA.InterfaceDef)
            self.__interf = self.__interf.describe_interface()
        except Exception, ex:
            self.__logger.logCritical("Cannot find a definition for '" +
                                       self.comp_type + "' components!")
            raise CORBA.NO_RESOURCES()
Ejemplo n.º 20
0
    def __init__(self, compname, comptype):
        '''
        Constructor
        '''
        #superclass constructor
        BaseRepresentation.__init__(self, compname)

        self.__logger = getLogger(str(Dynamic) + "(" + compname + ")")

        #---------------------------------------------------------------------
        def __initialize(args):
            '''
            Fake lifecycle method.
            '''
            self.__logger.logDebug("Simulated lifecyle method")
            return

        def __cleanUp(args):
            '''
            Fake lifecycle method.
            '''
            self.__logger.logDebug("Simulated lifecyle method")
            return

        self.setMethod('initialize', {'Timeout': 0.0, 'Value': __initialize})

        self.setMethod('cleanUp', {'Timeout': 0.0, 'Value': __cleanUp})

        #save the IDL type
        self.comp_type = comptype

        self.__interf = IR.lookup_id(comptype)
        try:
            self.__interf = self.__interf._narrow(CORBA.InterfaceDef)
            self.__interf = self.__interf.describe_interface()
        except Exception, ex:
            self.__logger.logCritical("Cannot find a definition for '" +
                                      self.comp_type + "' components!")
            raise CORBA.NO_RESOURCES()
Ejemplo n.º 21
0
    def __init__(self, compname):
        '''
        Constructor.
        
        Parameters:
        - compname is the name of the component to be simulated

        Returns: Nothing

        Raises: Nothing
        '''
        #save the name of the component we're looking for
        self.compname = str(compname)

        #our logger
        self.logger = getLogger(compname)

        #this dictionary contains descriptions of all simulated component methods
        #and attributes
        self.methods = {}
        
        #reference to the component
        self.comp_ref = None
Ejemplo n.º 22
0
    def __init__(self, name="Python Client"):
        '''
        Initialize the client.

        Parameters:
        - name is what manager will refer to this client instance as

        Returns: Nothing

        Raises: CORBAProblemExImpl
        '''
        #security token given to us by the manager
        self.token = None
        #name we will call ourself when contacting the manager
        self.name = str(name)
        #Logger used by container/components
        try:
            self.logger
        except:
            self.logger = getLogger(name)
        startPeriodicFlush(3)
        #List of components manager says are active
        self.managerComponents = []
        #CORBA reference to ourself
        self.corbaRef = None
        #True if the client is logged in
        self.loggedIn = False
        # Ensure that login and logout are executed in mutual exclusion
        self.loggingIn = Lock() 
        
        #get our token from manager
        self.token = self.managerLogin()
        
        #sanity check
        if self.token == None:
            # a nil token implies manager doesn't "like" this client
            raise CORBAProblemExImpl()
Ejemplo n.º 23
0
    def __init__(self, name="Python Client"):
        '''
        Initialize the client.

        Parameters:
        - name is what manager will refer to this client instance as

        Returns: Nothing

        Raises: CORBAProblemExImpl
        '''
        #security token given to us by the manager
        self.token = None
        #name we will call ourself when contacting the manager
        self.name = str(name)
        #Logger used by container/components
        try:
            self.logger
        except:
            self.logger = getLogger(name)
        startPeriodicFlush(3)
        #List of components manager says are active
        self.managerComponents = []
        #CORBA reference to ourself
        self.corbaRef = None
        #True if the client is logged in
        self.loggedIn = False
        # Ensure that login and logout are executed in mutual exclusion
        self.loggingIn = Lock()

        #get our token from manager
        self.token = self.managerLogin()

        #sanity check
        if self.token == None:
            # a nil token implies manager doesn't "like" this client
            raise CORBAProblemExImpl()
Ejemplo n.º 24
0
    def __init__(self, minimum_sleep=1000L):
        '''
        Standard Constructor.

        Parameters:
        - minimum_sleep is the amount of time the thread created by this class
        should sleep after looking over the list of timeouts that need to be
        executed. This is in ACS::Time units (i.e., 100ns).
        '''

        #mutex used to lock member variables that can be changed from one
        #of the threads spawned by this class
        self.lock = RLock()

        #unique identifier for each thread is also the total number of threads
        #that have been created by this object so far
        self.timeout_counter = 0

        #list of timeouts created by this class
        self.timeout_dict = {}

        #elementary amount of time to sleep (in ACS units)
        self.minimum_sleep = minimum_sleep

        self.logger = getLogger()

        #object has not been deleted
        self.alive = 1

        #create the thread which has the responsibility of executing timeouts
        self.executor_thread = Thread(target=self.__timeoutExecutor,
                                      name="Scheduler.__timeoutExecutor")
        self.executor_thread.setDaemon(1)
        #start the thread
        self.executor_thread.start()

        register(self.__destroy)
Ejemplo n.º 25
0
    def __init__(self, minimum_sleep=1000L):
        '''
        Standard Constructor.

        Parameters:
        - minimum_sleep is the amount of time the thread created by this class
        should sleep after looking over the list of timeouts that need to be
        executed. This is in ACS::Time units (i.e., 100ns).
        '''
        
        #mutex used to lock member variables that can be changed from one
        #of the threads spawned by this class
        self.lock = RLock()
        
        #unique identifier for each thread is also the total number of threads
        #that have been created by this object so far
        self.timeout_counter = 0
        
        #list of timeouts created by this class 
        self.timeout_dict = {}

        #elementary amount of time to sleep (in ACS units)
        self.minimum_sleep = minimum_sleep

        self.logger = getLogger()

        #object has not been deleted
        self.alive = 1

        #create the thread which has the responsibility of executing timeouts
        self.executor_thread = Thread(target=self.__timeoutExecutor,
                                      name="Scheduler.__timeoutExecutor")
        self.executor_thread.setDaemon(1)
        #start the thread
        self.executor_thread.start()
        
        register(self.__destroy)
Ejemplo n.º 26
0
def runAutoRAB(params):
	logger = getLogger("TSJavaImp Log")
	logger.logTrace( "runAutoRAB executed...")
Ejemplo n.º 27
0
def setup(params):
	logger = getLogger("LampImpl Log")
	logger.logTrace( "setup executed...")
Ejemplo n.º 28
0
def online():
	logger = getLogger("LampImpl Log")
	logger.logTrace( "online executed...")
Ejemplo n.º 29
0
def switchOff():
	logger = getLogger("LampImpl Log")
	logger.logTrace( "switchOff executed...")
Ejemplo n.º 30
0
def getRobotStatus(params):
	logger = getLogger("TSJavaImp Log")
	logger.logTrace( "getRobotStatus executed...")
Ejemplo n.º 31
0
def ping(params):
    logger = getLogger("PingerImpl Log")
    logger.logTrace("ping executed...")
Ejemplo n.º 32
0
def spawnChildren(params):
    logger = getLogger("PingerImpl Log")
    logger.logTrace("spawnChildren executed...")
Ejemplo n.º 33
0
def online():
    logger = getLogger("DeviceImpl Log")
    logger.logTrace("online executed...")
Ejemplo n.º 34
0
from new     import instance
from traceback import print_exc
#--CORBA STUBS-----------------------------------------------------------------
import CORBA
import ACSErr
import ACS
#--ACS Imports-----------------------------------------------------------------
from Acspy.Common.Log       import getLogger
from Acspy.Common.TimeHelper import getTimeStamp
from Acssim.Goodies           import *
from Acssim.Corba.KnownAcsTypes import getKnownBaciType
from Acssim.Corba.KnownAcsTypes import tryCallbackParams
from Acssim.Corba.Utilities import getDefinition
from ACSSim import DataErrorEx
#--GLOBALS---------------------------------------------------------------------
LOGGER = getLogger("Acssim.Corba.Generator")
#------------------------------------------------------------------------------
def getRandomValue(typeCode, compRef):
    '''
    TODO:
    - complete me!
    '''
    #Determine the value type first. This is really just an enumeration for the
    #CORBA typecode
    valType = typeCode.kind()
    
    #--------------------------------------------------------------------------
    #First check to see if valType is a simple CORBA type we can immediately return.
    #If this is the case it's just returned...otherwise an exception is thrown and...
    try:
        return getRandomSimpleValue(valType)
Ejemplo n.º 35
0
- 
'''
#--REGULAR IMPORTS-------------------------------------------------------------
from time import sleep
#--CORBA STUBS-----------------------------------------------------------------
import COUNTER
#--ACS Imports-----------------------------------------------------------------
from Acspy.Nc.Consumer import Consumer
from Acspy.Common.Log import getLogger
#--GLOBALS---------------------------------------------------------------------
#count is a global integer used to make sure we don't print more than five
#events to standard out.  really this is done just to make this module's modular
# test happy.
count = 0
contFlag = True
LOGGER = getLogger("contNcTestCounterConsumer")


#------------------------------------------------------------------------------
def counterDataHandler(someParam):
    '''
    This function serves only one purpose...it must do something with the extracted
    data from the structured event.  That is, it must be capable of processing
    filterable_data[0].any in the structured event.  We can be certain of the real
    type of someParam because handlers are registered only for specific
    types (i.e., the type_name field of a structured event).

    Parameters: someParam is the real CORBA type extracted from the CORBA Any at
    filterable_data[0].  In this case, it will always be a COUNTER.temperatureDataBlockEvent.

    Returns: event handler functions return nothing.
Ejemplo n.º 36
0
def proposalUnderExecution():
	logger = getLogger("SchedulerImpl Log")
	logger.logTrace( "proposalUnderExecution executed...")
Ejemplo n.º 37
0
def stop():
	logger = getLogger("SchedulerImpl Log")
	logger.logTrace( "stop executed...")
Ejemplo n.º 38
0
def move():
	logger = getLogger("MotorImpl Log")
	logger.logTrace( "move executed...")
Ejemplo n.º 39
0
def getRobotsList():
	logger = getLogger("TSJavaImp Log")
	logger.logTrace( "getRobotsList executed...")
Ejemplo n.º 40
0
def online():
	logger = getLogger("MotorImpl Log")
	logger.logTrace( "online executed...")
Ejemplo n.º 41
0
def logInfo():
    logger = getLogger("PingerImpl Log")
    logger.logTrace("logInfo executed...")
Ejemplo n.º 42
0
def setup(params):
	logger = getLogger("MotorImpl Log")
	logger.logTrace( "setup executed...")
Ejemplo n.º 43
0
def off():
    logger = getLogger("DeviceImpl Log")
    logger.logTrace("off executed...")
Ejemplo n.º 44
0
def off():
	logger = getLogger("CCDImagImpl Log")
	logger.logTrace( "off executed...")
Ejemplo n.º 45
0
def standby():
	logger = getLogger("MotorImpl Log")
	logger.logTrace( "standby executed...")
Ejemplo n.º 46
0
WHAT CAN I GAIN FROM THIS EXAMPLE?
- Supplier class usage.
- Publishing events.

LINKS
- 
'''
#--REGULAR IMPORTS-------------------------------------------------------------
from time import sleep
#--CORBA STUBS-----------------------------------------------------------------
import FRIDGE
#--ACS Imports-----------------------------------------------------------------
from Acspy.Nc.Supplier import Supplier
from Acspy.Common.Log import getLogger
#--GLOBALS---------------------------------------------------------------------
LOGGER = getLogger("FridgeNCSupplier")
#------------------------------------------------------------------------------
if __name__ == "__main__":

    #Create a supplier
    LOGGER.logInfo('Creating an instance of Supplier')
    g = Supplier(FRIDGE.CHANNELNAME_FRIDGE)

    #Create an instance of our user-defined IDL structure
    h = FRIDGE.temperatureDataBlockEvent(3.7, FRIDGE.ATREF)

    #Send 50 events
    LOGGER.logInfo("Ready to send NC events...")
    for i in range(50):
        g.publishEvent(simple_data=h)
        #Really just used for testing purposes
Ejemplo n.º 47
0
def off():
	logger = getLogger("MotorImpl Log")
	logger.logTrace( "off executed...")
Ejemplo n.º 48
0
def standby():
	logger = getLogger("CCDSpectroImpl Log")
	logger.logTrace( "standby executed...")
Ejemplo n.º 49
0
    try:
        #reraise a local ACS exception
        raise helperException
    except ACSErrTypePythonNative.PythonEx, e:
        #make sure we can catch the real CORBA exception
        helperException = ACSErrTypePythonNativeImpl.PythonExImpl(exception=e)
        #Printing to stdout AGAIN...should see TWO errorTraces this time around
        helperException.Print()

    #finally raise the exception out of the pseudo CORBA method
    raise helperException


###############################################################################
if __name__ == "__main__":
    logger = getLogger('Error Test')
    print "--main1-------------------------------------------------"
    try:
        fakeClientFunction()
    except ACSErrTypePythonNative.PythonEx, e:
        print "--main2-------------------------------------------------"
        helperException = ACSErrTypePythonNativeImpl.PythonExImpl(exception=e)
        #should be four error traces at this point
        helperException.Print()

    print "--main2-------------------------------------------------"
    print "Testing all public methods"
    print ""
    print "Grep me out", helperException.getErrorTrace()
    print "Grep me out", helperException.getNext()
    helperException.log(logger)
Ejemplo n.º 50
0
def online():
	logger = getLogger("CCDSpectroImpl Log")
	logger.logTrace( "online executed...")
Ejemplo n.º 51
0
def standby():
	logger = getLogger("LampImpl Log")
	logger.logTrace( "standby executed...")
Ejemplo n.º 52
0
def off():
	logger = getLogger("CCDSpectroImpl Log")
	logger.logTrace( "off executed...")
Ejemplo n.º 53
0
def off():
	logger = getLogger("LampImpl Log")
	logger.logTrace( "off executed...")
Ejemplo n.º 54
0
def setup(params):
	logger = getLogger("CCDSpectroImpl Log")
	logger.logTrace( "setup executed...")
Ejemplo n.º 55
0
from new import instance
from traceback import print_exc
#--CORBA STUBS-----------------------------------------------------------------
import CORBA
import ACSErr
import ACS
#--ACS Imports-----------------------------------------------------------------
from Acspy.Common.Log import getLogger
from Acspy.Common.TimeHelper import getTimeStamp
from Acssim.Goodies import *
from Acssim.Corba.KnownAcsTypes import getKnownBaciType
from Acssim.Corba.KnownAcsTypes import tryCallbackParams
from Acssim.Corba.Utilities import getDefinition
from ACSSim import DataErrorEx
#--GLOBALS---------------------------------------------------------------------
LOGGER = getLogger("Acssim.Corba.Generator")


#------------------------------------------------------------------------------
def getRandomValue(typeCode, compRef):
    '''
    TODO:
    - complete me!
    '''
    #Determine the value type first. This is really just an enumeration for the
    #CORBA typecode
    valType = typeCode.kind()

    #--------------------------------------------------------------------------
    #First check to see if valType is a simple CORBA type we can immediately return.
    #If this is the case it's just returned...otherwise an exception is thrown and...
Ejemplo n.º 56
0
def Park():
	logger = getLogger("prsComponentJavaImpl Log")
	logger.logTrace( "Park executed...")
Ejemplo n.º 57
0
"""
"""

from Acspy.Common.Log import getLogger
from Acspy.Clients.SimpleClient import PySimpleClient
from sys import argv
from time import sleep
import threading

num_test = int(argv[1])

# Make an instance of the PySimpleClient
simpleClient = PySimpleClient()

# Get logger
logger = getLogger()


# Autoreconnect ON, Notify Service restarted
def test1():
    name = "NamedCh_SUP1"
    name_con = "NamedCh_CON1"
    consumer = simpleClient.getComponent(name_con)
    supplier = simpleClient.getComponent(name)
    logger.logAlert("Calling supplier.testReconn1(True,True)")
    supplier.testReconn1(True, True)
    logger.logAlert("Waiting 20 seconds ...")
    sleep(20)
    logger.logAlert("Releasing component %s" % (name))
    simpleClient.releaseComponent(name)
    logger.logAlert("Releasing component %s" % (name_con))
Ejemplo n.º 58
0
def standby():
    logger = getLogger("DeviceImpl Log")
    logger.logTrace("standby executed...")