Gets the list of process ids that should be marked as high priority.
        :return: A list of process ids that are used by this bot in addition to the ones inside the python process.
174484
def get_extra_pids(self):
        
        while not self.is_retired:
            for proc in psutil.process_iter():
                for conn in proc.connections():
                    if conn.laddr.port == self.port:
                        self.logger.debug(f".NET socket server for {self.name} appears to have pid {proc.pid}")
                        return [proc.pid]
            if self.is_executable_configured():
                return []
            time.sleep(1)
            if self.dotnet_executable_path is None:
                self.logger.info("Can't auto-start .NET executable because no executable is configured. "
                                 "Please start the .NET bot manually!")
            else:
                self.logger.info(f"Can't auto-start .NET executable because {self.dotnet_executable_path} "
                                 "is not found. Please start the .NET bot manually!")
101309
def process_info(pid=None):
    '''
    '''
    if psutil is None:  # pragma    nocover
        return {}
    pid = pid or os.getpid()
    try:
        p = psutil.Process(pid)
    # this fails on platforms which don't allow multiprocessing
    except psutil.NoSuchProcess:  # pragma    nocover
        return {}
    else:
        mem = p.memory_info()
        return {'memory': convert_bytes(mem.rss),
                'memory_virtual': convert_bytes(mem.vms),
                'cpu_percent': p.cpu_percent(),
                'nice': p.nice(),
                'num_threads': p.num_threads()}
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;
    }
658083
public java.util.List<SuspendedProcess> getSuspendedProcesses() {
        if (suspendedProcesses == null) {
            suspendedProcesses = new com.amazonaws.internal.SdkInternalList<SuspendedProcess>();
        }
        return suspendedProcesses;
    }
965733
def _parse_ospf_process_id(self, config):
        
        match = re.search(r'^router ospf (\d+)', config)
        return dict(ospf_process_id=int(match.group(1)))
54753
def get_process_pid(process_name):
    
    try:
        pid_filename = get_pid_filename(process_name)
        with open(pid_filename, mode='r') as pid_file:
            pid = int(pid_file.read().strip())
    except IOError:
        pid = None
    return pid
955549
def is_running(process_id: int) -> bool:
    
    pstr = str(process_id)
    encoding = sys.getdefaultencoding()
    s = subprocess.Popen(["ps", "-p", pstr], stdout=subprocess.PIPE)
    for line in s.stdout:
        strline = line.decode(encoding)
        if pstr in strline:
            return True
    return False
203202
def get_process_pids(self, process):
        """"""
        pids = []
        cmd_line_glob = "/proc/[0-9]*/cmdline"
        cmd_line_paths = glob.glob(cmd_line_glob)
        for path in cmd_line_paths:
            try:
                with open(path, 'r') as f:
                    cmd_line = f.read().strip()
                    if process in cmd_line:
                        pids.append(path.split("/")[2])
            except IOError as e:
                continue
        return pids
50232
def get_processes(self):
        

        procs = set()

        try:
            # POSIX ps, so it should work in most environments where doge would
            p = sp.Popen(['ps', '-A', '-o', 'comm='], stdout=sp.PIPE)
            output, error = p.communicate()

            if sys.version_info > (3, 0):
                output = output.decode('utf-8')

            for comm in output.split('\n'):
                name = comm.split('/')[-1]
                # Filter short and weird ones
                if name and len(name) >= 2 and ':' not in name:
                    procs.add(name)

        finally:
            # Either it executed properly or no ps was found.
            proc_list = list(procs)
            random.shuffle(proc_list)
            return proc_list
1343585
def getVerifiersIDs(self):
        
        verifiers_ids = list()
        for brain in self.getAnalyses():
            verifiers_ids += brain.getVerificators
        return list(set(verifiers_ids))
862909
def worker_pids(cls):
        """"""
        cmd = "ps -A -o pid,command | grep pyres_worker | grep -v grep"
        output = commands.getoutput(cmd)
        if output:
            return map(lambda l: l.strip().split(' ')[0], output.split("\n"))
        else:
            return []
843081
def list(self):
        
        queue = self._get_queue()
        if queue is None:
            raise QueueDoesntExist

        output = self.check_output('%s' %
                                   shell_escape(queue / 'commands/list'))

        job_id, info = None, None
        for line in output.splitlines():
            line = line.decode('utf-8')
            if line.startswith('    '):
                key, value = line[4:].split(': ', 1)
                info[key] = value
            else:
                if job_id is not None:
                    yield job_id, info
                job_id = line
                info = {}
        if job_id is not None:
            yield job_id, info
570574
public List<ProcessMonitor> getProcessMonitors(RuntimeContext context) {
        return getProcessMonitors().stream().filter(monitor ->
            monitor.isEnabled(context)
        ).collect(Collectors.toList());
    }
283358
def get_num_processes():
    """"""
    cpu_count = multiprocessing.cpu_count()

    if config.NUMBER_OF_CORES == 0:
        raise ValueError(
            'Invalid NUMBER_OF_CORES; value may not be 0.')

    if config.NUMBER_OF_CORES > cpu_count:
        log.info('Requesting %s cores; only %s available',
                 config.NUMBER_OF_CORES, cpu_count)
        return cpu_count

    if config.NUMBER_OF_CORES < 0:
        num = cpu_count + config.NUMBER_OF_CORES + 1
        if num <= 0:
            raise ValueError(
                'Invalid NUMBER_OF_CORES; negative value is too negative: '
                'requesting {} cores, {} available.'.format(num, cpu_count))

        return num

    return config.NUMBER_OF_CORES
114550
def __IpsToServerIds(self):
    
    master_instance = self.__GetMasterInstance()
    assert(master_instance)
    retval, response = self.__RunMaprCli('node list -columns id')
    ip_to_id = {}
    for line_num, line in enumerate(response.split('\n')):
      tokens = line.split()
      if len(tokens) == 3 and tokens[0] != 'id':        
        instance_id = tokens[0]
        ip = tokens[2]
        ip_to_id[ip] = instance_id
    return ip_to_id
73486
def pipelines(self):
        
        if self._pipeline_manager is None:
            self._pipeline_manager = PipelineManager(session=self._session)
        return self._pipeline_manager
269565
def _analyze(self):
        
        pids = []

        for ip in self.filter['ips']:
            if ip in self.ips_to_pids:
                for pid in self.ips_to_pids[ip]:
                    pids.append(pid)

        for line in self.parsed_lines:
            if 'processid' in line and line['processid'] in pids:
                self.noisy_logs.append(line)
            else:
                self.quiet_logs.append(line)