@deferredAsThread
    def findProcesses(self):
        candidates = {}
        def safe_process(pid):
            try: #because processes can be invalid
                return AppProcess(Server(config.HOSTNAME), pid)
            except:
                err('problem')
                return None

        if self.PROCESS_REGEX:
            #rescan the whole system for processes
            for process in ( safe_process(pid) for pid in listProcesses() ):
                try:
                    if not process: continue 
                    if not process.__class__.isValid(process): continue
                    if process.pid in candidates: continue
                    if process.ppid != 1: continue #droned wants your daemons
                    if not process.running: continue
                    if not process.localInstall: continue
                    if process.managed: continue #already managed
                    cmd = ' '.join(process.cmdline)
                    if not cmd: continue
                    match = self.PROCESS_REGEX.search(cmd)
                    if not match: continue
                    #remember we tried to set some VARS on startInstance
                    _result = dict(**process.environ)
                    #allows us to set interesting parameters in the regex
                    _result.update(match.groupdict())
                    _result.update({'pid': process.pid})
                    candidates[_result['pid']] = _result
                except:
                    self.log('error searching for process check console log')
                    err('error searching for process')
        return sorted([(pid, d) for (pid, d) in candidates.items() if pid > 1])
Attempt to find a process by an ASSIMILATION pattern.
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/applications/__init__.py/ApplicationPlugin.findProcesses