Exemple #1
0
 def __init__(self, original):
     self.process = NullProcess() #assume the process is dead
     if original.server.hostname == config.HOSTNAME:
         #delay scanning the process, for as long as possible
         try: self.process = LiveProcess(original.pid, fast=True)
         except InvalidProcess: pass #raise all others
     else:
         self.process = RemoteProcess(ai.pid)
     #make an attempt to update the original caller
     if hasattr(original, 'pid'):
         try: original.pid = self.process.pid
         except: pass
     if hasattr(original, 'inode'):
         try: original.inode = self.process.inode
         except: pass
Exemple #2
0
class AdaptToProcess(object):
    """I can adapt a L{IDroneModelAppProcess} provider or a 
       L{IDroneModelAppInstance} provider to a L{IKittProcess} provider.

       I hold no references to the Original Object after Instantiation.
    """
    implements(IKittProcess)
    def __init__(self, original):
        self.process = NullProcess() #assume the process is dead
        if original.server.hostname == config.HOSTNAME:
            #delay scanning the process, for as long as possible
            try: self.process = LiveProcess(original.pid, fast=True)
            except InvalidProcess: pass #raise all others
        else:
            self.process = RemoteProcess(ai.pid)
        #make an attempt to update the original caller
        if hasattr(original, 'pid'):
            try: original.pid = self.process.pid
            except: pass
        if hasattr(original, 'inode'):
            try: original.inode = self.process.inode
            except: pass

    def __getattribute__(self, name):
        try: return object.__getattribute__(self, name)
        except: return self.process.__getattribute__(name)
Exemple #3
0
class AdaptToProcess(object):
    """I can adapt a L{IDroneModelAppProcess} provider or a 
       L{IDroneModelAppInstance} provider to a L{IKittProcess} provider.

       I hold no references to the Original Object after Instantiation.
    """
    implements(IKittProcess)

    def __init__(self, original):
        self.process = NullProcess()  #assume the process is dead
        if original.server.hostname == config.HOSTNAME:
            #delay scanning the process, for as long as possible
            try:
                self.process = ProcessSnapshot(original.pid)
            except InvalidProcess:
                pass  #raise all others
        else:
            self.process = RemoteProcess(original.pid)
        #make an attempt to update the original caller
        if hasattr(original, 'pid'):
            try:
                original.pid = self.process.pid
            except:
                pass
        if hasattr(original, 'inode'):
            try:
                original.inode = self.process.inode
            except:
                pass

    def __getattribute__(self, name):
        try:
            return object.__getattribute__(self, name)
        except:
            return self.process.__getattribute__(name)
Exemple #4
0
 def __init__(self, original):
     self.process = NullProcess()  #assume the process is dead
     if original.server.hostname == config.HOSTNAME:
         #delay scanning the process, for as long as possible
         try:
             self.process = ProcessSnapshot(original.pid)
         except InvalidProcess:
             pass  #raise all others
     else:
         self.process = RemoteProcess(original.pid)
     #make an attempt to update the original caller
     if hasattr(original, 'pid'):
         try:
             original.pid = self.process.pid
         except:
             pass
     if hasattr(original, 'inode'):
         try:
             original.inode = self.process.inode
         except:
             pass