Esempio n. 1
0
 def process(self):
     """@return L{IKittProcess} provider"""
     #work around constructor and allow a process to appear to die
     if not hasattr(self, '_process'):
         #adapt this model to a IKittProcess
         self._process = IKittProcess(self)
     elif self._process.pid != self.pid or not self._process.running:
         if config.HOSTNAME == self.server.hostname:
             AppProcess.delete(
                 self)  #take ourself out of serialization loop
             self._process = IKittNullProcess(
                 self)  #continue to work for any other refs
     return self._process
Esempio n. 2
0
    def process(self):
        """The process object contained by this application instance

           @raise InvalidProcess
           @return (instance of AppProcess)
        """
        if not hasattr(self, '_process'):
            #try to grab a live process, on exception grab a NullProcess
            try:
                assert self.pid  #save the scan attempt
                self._process = IDroneModelAppProcess(self)
            except:
                self._process = IKittNullProcess(
                    self)  #should be a NullProcess
        elif IDroneModelAppProcess.providedBy(self._process) and not \
                AppProcess.isValid(self._process):
            self._process = IKittNullProcess(self)
        #keep the journal up to date
        self.info.update({
            'pid': self._process.pid,
            'inode': self._process.inode,
        })
        return self._process