def GetChildPids(self, pid): """Returns a list of child pids of |pid|.""" all_process_info = self._cri.ListProcesses() processes = [(curr_pid, curr_ppid, curr_state) for curr_pid, _, curr_ppid, curr_state in all_process_info ] return ps_util.GetChildPids(processes, pid)
def GetChildPids(self, pid): """Returns a list of child pids of |pid|.""" ps_output = self.GetPsOutput(['pid', 'ppid', 'state']) ps_line_re = re.compile( r'\s*(?P<pid>\d+)\s*(?P<ppid>\d+)\s*(?P<state>\S*)\s*') processes = [] for pid_ppid_state in ps_output: m = ps_line_re.match(pid_ppid_state) assert m, 'Did not understand ps output: %s' % pid_ppid_state processes.append((m.group('pid'), m.group('ppid'), m.group('state'))) return ps_util.GetChildPids(processes, pid)