Only looks in current processes (not archived).
979312
public List<Process> findCalledProcesses(Process mainproc, ProgressMonitor... monitors) throws IOException {
        List<Process> processes = new ArrayList<>();
        for (String pkg : getPackageProcesses().keySet()) {
            for (File procFile : getPackageProcesses().get(pkg)) {
                processes.add(loadProcess(pkg, procFile, true));
            }
        }
        return ProcessHierarchy.findInvoked(mainproc, processes);
    }
45225
def is_obsoleted_by_pid(pid):
    
    return d1_gmn.app.models.ScienceObject.objects.filter(
        obsoleted_by__did=pid
    ).exists()
654803
protected function is_process_running() {
	    $lockData = get_option($this->identifier . '_process_lock', null);

	    if (!empty($lockData) || isset($lockData['expires'])) {
            if (time() <= $lockData['expires']) {
                Logger::info('Lock still active.  Expires in: '.($lockData['expires'] - time()));

                return true;
            } else {
                Logger::info("Lock expired");
            }
        }

        if (!empty($lockData)) {
            delete_option($this->identifier . '_process_lock');
        } else {
            Logger::info('No lock data.');
        }

        return false;
	}
318793
def clear_unattached_processes(self):
        
        for pid in self.get_process_ids():
            aProcess = self.get_process(pid)
            if not aProcess.is_being_debugged():
                self._del_process(aProcess)
719948
function() {
        if (process.platform !== 'darwin') {
            return;
        }

        // top is running in logging mode, spewing process info to stdout every second.
        this._topConsole = child_process.spawn('/usr/bin/top', ['-l', '0', '-stats', 'pid,cpu,mem,command']);
        this._topConsole.stdout.on('data', _.bind(function(stdout) {
            var id = $$persistence.processId();
            if (!id) {
                return;
            }

            // Find the line with the process id that matches what we're watching.
            stdout = stdout.toString();
            var lines = stdout.split('\n');
            var line = lines.filter(function(line) {
                return line.indexOf(id) === 0;
            })[0];
            if (!line) {
                return;
            }
            var parts = line.split(/\s+/g);

            // Add to the CPU history.
            var cpu = parseFloat(parts[1]);
            this._cpuFrame(cpu);

            // Add to the memory history.
            var memory = parts[2];
            var unit = 1;
            if (memory.indexOf('K') !== -1) {
                unit = 1024;
            } else if (memory.indexOf('M') !== -1) {
                unit = 1024 * 1024;
            } else if (memory.indexOf('G') !== -1) {
                unit = 1024 * 1024 * 1024;
            }
            memory = memory.replace(/[\D]/g, '');
            memory = parseInt(memory) * unit;
            this._memoryFrame(memory);

        }, this));
    }
558156
def get_cpu_usage(user=None, ignore_self=True):
    
    pid = os.getpid()
    cmd = "ps aux"
    output = getoutput(cmd)
    total = 0
    largest_process = 0
    largest_process_name = None
    for row in output.split('\n')[1:]:
        row = row.split()
        if row[1] == str(pid) and ignore_self:
            continue
        if user is None or user == row[0]:
            cpu = decimal.Decimal(row[2])
            if cpu > total:
                largest_process = cpu
                largest_process_name = ' '.join(row[10:len(row)])
            total += decimal.Decimal(row[2])
    return total, largest_process, largest_process_name
558560
@Override
    public Collection<NodeInstanceDesc> getProcessInstanceHistoryActive(long processId, QueryContext queryContext) {
        return getProcessInstanceHistory(processId, false, queryContext);
    }
129709
def get_process_mapping():
    
    with open('/proc/{0}/stat'.format(os.getpid())) as f:
        self_tty = f.read().split()[STAT_TTY]
    processes = {}
    for pid in os.listdir('/proc'):
        if not pid.isdigit():
            continue
        try:
            stat = '/proc/{0}/stat'.format(pid)
            cmdline = '/proc/{0}/cmdline'.format(pid)
            with open(stat) as fstat, open(cmdline) as fcmdline:
                stat = re.findall(r'\(.+\)|\S+', fstat.read())
                cmd = fcmdline.read().split('\x00')[:-1]
            ppid = stat[STAT_PPID]
            tty = stat[STAT_TTY]
            if tty == self_tty:
                processes[pid] = Process(
                    args=tuple(cmd), pid=pid, ppid=ppid,
                )
        except IOError:
            # Process has disappeared - just ignore it.
            continue
    return processes
504154
def processes(self):
        """"""
        return self._h._get_resources(
            resource=('apps', self.name, 'ps'),
            obj=Process, app=self, map=ProcessListResource
        )
645444
private static List<String> getSimpleProcess(String processPath, Map<String, String> prms)
    {
        List<String> res = new ArrayList<>(10);

        // Process itself
        res.add(processPath);

        // Optional parameters - keys are just indices to sort the values.
        if (prms.isEmpty())
        {
            return res;
        }

        List<String> keys = new ArrayList<>(prms.keySet());
        Collections.sort(keys, prmComparator);
        for (String p : keys)
        {
            if (!prms.get(p).trim().isEmpty())
            {
                res.add(prms.get(p).trim());
            }
        }

        // Done
        return res;
    }
281392
def is_filtered(self, process):
        
        if self.filter is None:
            # No filter => Not filtered
            return False

        if self.filter_key is None:
            # Apply filter on command line and process name
            return self._is_process_filtered(process, key='name') or \
                self._is_process_filtered(process, key='cmdline')
        else:
            # Apply filter on <key>
            return self._is_process_filtered(process)
361002
def getProcessStatus(self):
        
        info_dict = {}
        cur = self._conn.cursor()
        cur.execute("""SHOW FULL PROCESSLIST;""")
        rows = cur.fetchall()
        if rows:
            for row in rows:
                if row[6] == '':
                    state = 'idle'
                elif row[6] is None:
                    state = 'other'
                else:
                    state = str(row[6]).replace(' ', '_').lower()
                info_dict[state] = info_dict.get(state, 0) + 1
        return info_dict
734306
def is_dead(self, proc, name):
        
        LOGGER.debug('Checking %s (%r)', name, proc)
        try:
            status = proc.status()
        except psutil.NoSuchProcess:
            LOGGER.debug('NoSuchProcess: %s (%r)', name, proc)
            return True

        LOGGER.debug('Process %s (%s) status: %r (Unresponsive Count: %s)',
                     name, proc.pid, status, self.unresponsive[name])
        if status in _PROCESS_RUNNING:
            return False
        elif status == psutil.STATUS_ZOMBIE:
            try:
                proc.wait(0.1)
            except psutil.TimeoutExpired:
                pass
            try:
                proc.terminate()
                status = proc.status()
            except psutil.NoSuchProcess:
                LOGGER.debug('NoSuchProcess: %s (%r)', name, proc)
                return True
        return status in _PROCESS_STOPPED_OR_DEAD
609179
def is_cached(self, version=None):
        '''
        
        '''
        version = _process_version(self, version)

        if self.api.cache and self.api.cache.fs.isfile(
                self.get_version_path(version)):
            return True

        return False
1330749
def check_running(self):
        '''
        
        '''

        if self.check_pidfile():
            pid = self.get_pidfile()
            if not salt.utils.platform.is_windows():
                if self.check_pidfile() and self.is_daemonized(pid) and os.getppid() != pid:
                    return True
            else:
                # We have no os.getppid() on Windows. Use salt.utils.win_functions.get_parent_pid
                if self.check_pidfile() and self.is_daemonized(pid) and salt.utils.win_functions.get_parent_pid() != pid:
                    return True
        return False
596369
def _get_user_processes():
    

    uid = os.getuid()

    for proc in psutil.process_iter():
        try:
            # yield processes that match current user
            if proc.uids.real == uid:
                yield (proc, proc.exe)

        except psutil.AccessDenied:
            # work around for suid/sguid processes and MacOS X restrictions
            try:
                path = common.which(proc.name)

                # psutil doesn't support MacOS X relative paths,
                # let's use a workaround to merge working directory with
                # process relative path
                if not path and common.IS_MACOSX:
                    cwd = _get_process_cwd(proc.pid)
                    if not cwd:
                        continue
                    path = os.path.join(cwd, proc.cmdline[0])

                yield (proc, path)

            except (psutil.AccessDenied, OSError):
                pass

        except psutil.NoSuchProcess:
            pass
1023028
def is_valid_pid_to_be_updated(did):
    """"""
    return (
        is_existing_object(did)
        and not is_local_replica(did)
        and not is_archived(did)
        and not is_obsoleted(did)
    )