def initialize(self):
            ExecutableDevice.initialize(self)
            
            # Instantiate the default implementations for all ports on this component
            self.port_dev_resource_in = PortCFResourceIn_i(self, "dev_resource_in")

            self.port_dev_resource_out = PortCFResourceOut_i(self, "dev_resource_out")
Example #2
0
        def initialize(self):
            ExecutableDevice.initialize(self)
            
            # Instantiate the default implementations for all ports on this component
            self.port_dev_resource_in = PortCFResourceIn_i(self, "dev_resource_in")

            self.port_dev_resource_out = PortCFResourceOut_i(self, "dev_resource_out")
Example #3
0
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
              execparams):
     ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                               compositeDevice, execparams, PROPERTIES)
     AggregateDevice.__init__(self)
     self._props["memCapacity"] = 100000000
     self._props["BogoMipsCapacity"] = 100000000
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
   ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
   AggregateDevice.__init__(self)
   self._props["memCapacity"] = 100000000
   self._props["BogoMipsCapacity"] = 100000000
   self._props["nicCapacity"] = 100.0
   self._props["fakeCapacity"] = 3
   self._props["execparams"] = " ".join(["%s %s" % x for x in execparams.items()])
Example #5
0
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
     ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams)
     self.threadControlLock = threading.RLock()
     self.process_thread = None
     # self.auto_start is deprecated and is only kept for API compatability
     # with 1.7.X and 1.8.0 components.  This variable may be removed
     # in future releases
     self.auto_start = False
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
   ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
   AggregateDevice.__init__(self)
   self._props["memCapacity"] = 100000000
   self._props["BogoMipsCapacity"] = 100000000
   self._props["nicCapacity"] = 100.0
   self._props["fakeCapacity"] = 3
   self._props["execparams"] = " ".join(["%s %s" % x for x in execparams.items()])
 def initialize(self):
   ExecutableDevice.initialize(self)
   self._props["memCapacity"] = 100000000
   self._props["BogoMipsCapacity"] = 100000000
   self._props["nicCapacity"] = 100.0
   self._props["fakeCapacity"] = 3
   #self._props["execparams"] = " ".join(["%s %s" % x for x in execparams.items()])
   self._usageState = CF.Device.BUSY
Example #8
0
 def start(self):
     self.threadControlLock.acquire()
     try:
         ExecutableDevice.start(self)
         if self.process_thread == None:
             self.process_thread = ProcessThread(target=self.process, pause=self.PAUSE)
             self.process_thread.start()
     finally:
         self.threadControlLock.release()
 def releaseObject(self):
     try:
         self.stop()
     except Exception:
         self._log.exception("Error stopping")
     self.threadControlLock.acquire()
     try:
         ExecutableDevice.releaseObject(self)
     finally:
         self.threadControlLock.release()
Example #10
0
 def releaseObject(self):
     try:
         self.stop()
     except Exception:
         self._log.exception("Error stopping")
     self.threadControlLock.acquire()
     try:
         ExecutableDevice.releaseObject(self)
     finally:
         self.threadControlLock.release()
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 devices.  This variable may be removed
        # in future releases
        self.auto_start = False
    def stop(self):
        # Technically not thread-safe but close enough for now
        process_thread = self.process_thread
        self.process_thread = None

        if process_thread != None:
            process_thread.stop()
            process_thread.join(self.TIMEOUT)
            if process_thread.isAlive():
                raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")
        ExecutableDevice.stop(self)
        def stop(self):
            # Technically not thread-safe but close enough for now
            process_thread = self.process_thread
            self.process_thread = None

            if process_thread != None:
                process_thread.stop()
                process_thread.join(self.TIMEOUT)
                if process_thread.isAlive():
                    raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")
            ExecutableDevice.stop(self)
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
   self.exit_lock = threading.Lock()
   self.exit_lock.acquire()
   self.process_thread = threading.Thread(target=self.TerminationThread)
   ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
   AggregateDevice.__init__(self)
   self._props["memCapacity"] = 100000000
   self._props["BogoMipsCapacity"] = 100000000
   self._props["nicCapacity"] = 100.0
   self._props["fakeCapacity"] = 3
   self._props["execparams"] = " ".join(["%s %s" % x for x in execparams.items()])
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
        # NB: For now, the ports must be created before calling ExecutableDevice.__init__(),
        #     which registers with the DomainManager, otherwise a race condition may exist.
        #     The DomainManager attempts to make the connections from the DCD, and it is
        #     possible that getPort() will be called before __init__() completes.
        self.ports = {}
        self.ports['event_supplier'] = supplierOut_i(self, 'event_supplier')
        self.ports['event_consumer'] = consumerOut_i(self, 'event_consumer')

        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
        self._props["memCapacity"] = 100000000
        self._props["BogoMipsCapacity"] = 100000000
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
        AggregateDevice.__init__(self)

        self.__MAX_MEMORY   = 2048
        self.__MAX_BOGOMIPS = 1024
        self.allocated_mem  = 0
        self.allocated_bog  = 0
        self.__mem_name     = 'memCapacity'
        self.__bog_name     = 'BogoMipsCapacity'
        self.__mem_id       = 'DCE:7aeaace8-350e-48da-8d77-f97c2e722e06'
        self.__bog_id       = 'DCE:bbdf708f-ce05-469f-8aed-f5c93e353e14'
Example #17
0
        def stop(self):
            self.threadControlLock.acquire()
            try:
                process_thread = self.process_thread
                self.process_thread = None

                if process_thread != None:
                    process_thread.stop()
                    process_thread.join(self.TIMEOUT)
                    if process_thread.isAlive():
                        raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")
                ExecutableDevice.stop(self)
            finally:
                self.threadControlLock.release()
Example #18
0
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        # NB: For now, the ports must be created before calling ExecutableDevice.__init__(),
        #     which registers with the DomainManager, otherwise a race condition may exist.
        #     The DomainManager attempts to make the connections from the DCD, and it is
        #     possible that getPort() will be called before __init__() completes.
        self.ports = {}
        self.ports['event_supplier'] = supplierOut_i(self, 'event_supplier')
        self.ports['event_consumer'] = consumerOut_i(self, 'event_consumer')

        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams, PROPERTIES)
        self._props["memCapacity"] = 100000000
        self._props["BogoMipsCapacity"] = 100000000
Example #19
0
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
              execparams):
     self.exit_lock = threading.Lock()
     self.exit_lock.acquire()
     self.process_thread = threading.Thread(target=self.TerminationThread)
     ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                               compositeDevice, execparams, PROPERTIES)
     AggregateDevice.__init__(self)
     self._props["memCapacity"] = 100000000
     self._props["BogoMipsCapacity"] = 100000000
     self._props["nicCapacity"] = 100.0
     self._props["fakeCapacity"] = 3
     self._props["execparams"] = " ".join(
         ["%s %s" % x for x in execparams.items()])
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams, PROPERTIES)
        AggregateDevice.__init__(self)

        self.__MAX_MEMORY = 2048
        self.__MAX_BOGOMIPS = 1024
        self.allocated_mem = 0
        self.allocated_bog = 0
        self.__mem_name = 'memCapacity'
        self.__bog_name = 'BogoMipsCapacity'
        self.__mem_id = 'DCE:7aeaace8-350e-48da-8d77-f97c2e722e06'
        self.__bog_id = 'DCE:bbdf708f-ce05-469f-8aed-f5c93e353e14'
 def execute(self, name, options, parameters):
   retval = ExecutableDevice.execute(self, name, options, parameters)
   for option in options:
       if option.id == 'STACK_SIZE':
           self._props['check_STACK_SIZE'] = option.value._v
       elif option.id == 'PRIORITY':
           self._props['check_PRIORITY'] = option.value._v
   return retval
 def execute(self, name, options, parameters):
     retval = ExecutableDevice.execute(self, name, options, parameters)
     for option in options:
         if option.id == 'STACK_SIZE':
             self._props['check_STACK_SIZE'] = option.value._v
         elif option.id == 'PRIORITY':
             self._props['check_PRIORITY'] = option.value._v
     return retval
Example #23
0
class BasicTestDevice_python_impl1(CF__POA.AggregateExecutableDevice,
                                   ExecutableDevice, AggregateDevice):
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams, PROPERTIES)
        AggregateDevice.__init__(self)

        self.process_thread = None
        self.__MAX_MEMORY = 2048
        self.__MAX_BOGOMIPS = 1024
        self.allocated_mem = 0
        self.allocated_bog = 0
        self.__mem_name = 'memCapacity'
        self.__bog_name = 'BogoMipsCapacity'
        self.__mem_id = 'DCE:7aeaace8-350e-48da-8d77-f97c2e722e06'
        self.__bog_id = 'DCE:bbdf708f-ce05-469f-8aed-f5c93e353e14'

    ###########################################
    # CF::LifeCycle
    ###########################################
    def initialize(self):
        ExecutableDevice.initialize(self)

    def start(self):
        ExecutableDevice.start(self)
        self.process_thread = ProcessThread(target=self.process,
                                            pause=self.PAUSE)
        self.process_thread.start()

    def process(self):
        return NOOP

    def stop(self):
        # Technically not thread-safe but close enough for now
        process_thread = self.process_thread
        self.process_thread = None

        if process_thread != None:
            process_thread.stop()
            process_thread.join(self.TIMEOUT)
            if process_thread.isAlive():
                raise CF.Resource.StopError(CF.CF_NOTSET,
                                            "Processing thread did not die")
        ExecutableDevice.stop(self)

    def releaseObject(self):
        try:
            self.stop()
        except Exception, e:
            if self._log != None:
                self._log.exception("Error stopping: ", e)
        ExecutableDevice.releaseObject(self)
class PythonExecDev_python_impl1_base(CF__POA.ExecutableDevice,
                                      ExecutableDevice):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams)
        self.process_thread = None

    def initialize(self):
        ExecutableDevice.initialize(self)

    def start(self):
        ExecutableDevice.start(self)
        self.process_thread = ProcessThread(target=self.process,
                                            pause=self.PAUSE)
        self.process_thread.start()

    def process(self):
        """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
        raise NotImplementedError

    def stop(self):
        # Technically not thread-safe but close enough for now
        process_thread = self.process_thread
        self.process_thread = None

        if process_thread != None:
            process_thread.stop()
            process_thread.join(self.TIMEOUT)
            if process_thread.isAlive():
                raise CF.Resource.StopError(CF.CF_NOTSET,
                                            "Processing thread did not die")
        ExecutableDevice.stop(self)

    def releaseObject(self):
        try:
            self.stop()
        except Exception, e:
            self._log.exception("Error stopping: ", e)
        ExecutableDevice.releaseObject(self)
 def __getattribute__(self, attrname):
     """
 Intercept lookup of attributes to allow any method to throw an
 error via the 'exceptionPoint' and 'exceptionType' properties.
 """
     # Use the base class __getattribute__ to avoid recursion.
     getattribute = lambda x: ExecutableDevice.__getattribute__(self, x)
     attribute = getattribute(attrname)
     if callable(attribute) and attrname == getattribute('exceptionPoint'):
         if getattribute('exceptionType') == 'CF.InvalidFileName':
             exception = CF.InvalidFileName(CF.CF_EINVAL, "Test exception")
         elif self.exceptionType == 'CF.Device.InvalidCapacity':
             exception = CF.Device.InvalidCapacity("Test exception", [])
         else:
             exception = Exception()
         return ExceptionFunc(exception)
     return attribute
 def __getattribute__ (self, attrname):
   """
   Intercept lookup of attributes to allow any method to throw an
   error via the 'exceptionPoint' and 'exceptionType' properties.
   """
   # Use the base class __getattribute__ to avoid recursion.
   getattribute = lambda x: ExecutableDevice.__getattribute__(self, x)
   attribute = getattribute(attrname)
   if callable(attribute) and attrname == getattribute('exceptionPoint'):
     if getattribute('exceptionType') == 'CF.InvalidFileName':
       exception = CF.InvalidFileName(CF.CF_EINVAL, "Test exception")
     elif self.exceptionType == 'CF.Device.InvalidCapacity':
       exception = CF.Device.InvalidCapacity("Test exception", [])
     else:
       exception = Exception()
     return ExceptionFunc(exception)
   return attribute
 def __init__ (self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
   ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams)
 def releaseObject(self):
     a = b
     ExecutableDevice.releaseObject(self)
 def start(self):
     ExecutableDevice.start(self)
     self.process_thread = ProcessThread(target=self.process,
                                         pause=self.PAUSE)
     self.process_thread.start()
Example #30
0
 def configure(self, properties):
     ExecutableDevice.configure(self, properties)
     self.process_thread.start()
 def configure(self, properties):
   ExecutableDevice.configure(self, properties)
   self.process_thread.start()
Example #32
0
 def initialize(self):
     ExecutableDevice.initialize(self)
     
     # Instantiate the default implementations for all ports on this component
     self.port_propEvent = PropertyEventSupplier(self)
 def stop(self):
     ExecutableDevice.stop(self)
     if not ThreadedComponent.stopThread(self, self.TIMEOUT):
         raise CF.Resource.StopError(CF.CF_NOTSET,
                                     "Processing thread did not die")
 def start(self):
     ExecutableDevice.start(self)
     ThreadedComponent.startThread(self, pause=self.PAUSE)
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
   ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
   AggregateDevice.__init__(self)
   self._props["memCapacity"] = 100000000
   self._props["BogoMipsCapacity"] = 100000000
Example #36
0
 def releaseObject(self):
     a = b
     ExecutableDevice.releaseObject(self)
 def execute (self, *args):
   if self.crashEnabled:
     os.kill(os.getpid(), signal.SIGKILL)
   return ExecutableDevice.execute(self, *args)
 def releaseObject(self):
     try:
         self.stop()
     except Exception:
         self._log.exception("Error stopping")
     ExecutableDevice.releaseObject(self)
Example #39
0
 def execute(self, *args):
     if self.crashEnabled:
         os.kill(os.getpid(), signal.SIGKILL)
     return ExecutableDevice.execute(self, *args)
 def initialize(self):
     ExecutableDevice.initialize(self)
     self.toTest = testOut_i(self, "resource_out")
     self.toDevMgr = devicemanagerOut_i(self, "devicemanager_out")
     self.fromOther = fromOther_i(self, "resource_in")
 def initialize(self):
     ExecutableDevice.initialize(self)
     self.toTest = testOut_i(self, "resource_out")
Example #42
0
 def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
              execparams):
     ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                               compositeDevice, execparams)
Example #43
0
 def initialize(self):
     ExecutableDevice.initialize(self)
Example #44
0
 def initialize(self):
     ExecutableDevice.initialize(self)
     self.toTest = testOut_i(self, "resource_out")
     self.toDevMgr = devicemanagerOut_i(self, "devicemanager_out")
     self.fromOther = fromOther_i(self, "resource_in")
 def initialize(self):
     ExecutableDevice.initialize(self)
 def start(self):
     ExecutableDevice.start(self)
     self.process_thread = ProcessThread(target=self.process, pause=self.PAUSE)
     self.process_thread.start()