MCPcopy Create free account
hub / github.com/apache/impala / __get_procs

Method __get_procs

tests/common/impala_cluster.py:484–509  ·  view source on GitHub ↗

Returns a list of dicts containing {pid, ppid, cmdline} for related processes.

(self)

Source from the content-addressed store, hash-verified

482 return result
483
484 def __get_procs(self):
485 """
486 Returns a list of dicts containing {pid, ppid, cmdline} for related processes.
487 """
488 if self.container_id is not None:
489 container_info = get_container_info(self.container_id)
490 if container_info["State"]["Status"] != "running":
491 return []
492 return [{'pid': container_info["State"]["Pid"], 'ppid': 0, 'cmdline': self.cmd}]
493
494 # In non-containerised case, search for process based on matching command lines.
495 procs = []
496 for process in psutil.process_iter(['pid', 'ppid', 'cmdline']):
497 # psutil changed behavior for process_iter() so that it no longer checks
498 # for reused pids. Use is_running() to do that.
499 if not process.is_running():
500 continue
501
502 # psutil returns None for fields from a zombie process
503 if not process.info['cmdline']:
504 continue
505
506 # Use info because it won't throw NoSuchProcess exceptions.
507 if set(self.cmd) == set(process.info['cmdline']):
508 procs.append(process.info)
509 return procs
510
511 def kill(self, signal=SIGKILL):
512 """

Callers 2

get_pidsMethod · 0.95
__get_pidMethod · 0.95

Calls 3

get_container_infoFunction · 0.85
is_runningMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected