Check up on child processes and make sure everything is running as
        it should be.
547943
def process(self):
        
        children = len(self.living_children)
        LOGGER.debug('%i active child%s',
                     children, '' if children == 1 else 'ren')
105308
def is_running(self):
        
        return self._process.state() in [self._process.Running, self._process.Starting]
1316673
def apply
      started_at = DateTime.now.to_s
      # Check if a Puppetfile is neccesary for use/not use librarian-puppet
      check_puppetfile_content
      # Copy static modules that are not downloaded by librarian-puppet
      copy_static_modules
      # Apply step and if the process is succesful create the checkpoint.
      process_status = apply_step
      create_step_checkpoint(started_at) if process_status.success?
      process_status
    end
937973
void monitorChild() {
    Process proc = childProc;
    if (proc == null) {
      // Process may have already been disposed of, e.g. by calling kill().
      return;
    }

    while (proc.isAlive()) {
      try {
        proc.waitFor();
      } catch (Exception e) {
        LOG.log(Level.WARNING, "Exception waiting for child process to exit.", e);
      }
    }

    synchronized (this) {
      if (isDisposed()) {
        return;
      }

      int ec;
      try {
        ec = proc.exitValue();
      } catch (Exception e) {
        LOG.log(Level.WARNING, "Exception getting child process exit code, assuming failure.", e);
        ec = 1;
      }

      if (ec != 0) {
        State currState = getState();
        // Override state with failure if the current state is not final, or is success.
        if (!currState.isFinal() || currState == State.FINISHED) {
          setState(State.FAILED, true);
        }
      }

      dispose();
    }
  }
347860
def run(self):
        """"""
        # Catch all possible exceptions raised by the running thread
        # and let parent process know about it.
        try:
            self._run()
        except Exception:  # pylint: disable=broad-except
            self.action.put(
                ServiceCheckDiedError(self.name, traceback.format_exc())
            )
66446
def run_recursively_and_collect_multiple_changes(monitor, times, directory, *flags, &block)
      watch_and_run(monitor, times, true, directory, *flags, &block)
    end
774203
def start_processes(self, max_restarts=-1):
        
        while 1:
            for process in self.processes:
                if not process:
                    # When process has not been started, start it
                    if not process.has_started:
                        process.start()
                        continue
                    # When process has stopped, start it again
                    exitcode = process.exitcode
                    if exitcode != 0:
                        # Process has been signaled or crashed
                        if exitcode > 0:
                            self.logger.error(
                                "Process '%s' with pid %d died with exitcode "
                                "%d", process.name, process.pid, exitcode
                            )
                        else:
                            self.logger.error(
                                "Process '%s' with pid %d died due to %s",
                                process.name, process.pid,
                                SIGNALS_TO_NAMES_DICT[abs(exitcode)]
                            )
                        # Max restarts has been reached, exit
                        if not max_restarts:
                            self.logger.fatal("Too many child restarts")
                            break
                        # Start process again
                        process.start()
                        # Decrement max_restarts counter
                        if max_restarts > 0:
                            max_restarts -= 1
                    else:
                        # Process has stopped without error
                        self.logger.info(
                            "Process '%s' with pid %d has stopped",
                            process.name, process.pid
                        )
                        # Start process again
                        process.start()
                        self.logger.info(
                            "Process '%s' has been started with pid %d",
                            process.name, process.pid
                        )
            else:
                time.sleep(0.25)
                continue
            break
607089
def run(self):
        '''
        
        '''
        salt.utils.process.appendproctitle(self.__class__.__name__)

        # init things that need to be done after the process is forked
        self._post_fork_init()

        # Make Start Times
        last = int(time.time())

        old_present = set()
        while True:
            now = int(time.time())
            if (now - last) >= self.loop_interval:
                salt.daemons.masterapi.clean_old_jobs(self.opts)
                salt.daemons.masterapi.clean_expired_tokens(self.opts)
                salt.daemons.masterapi.clean_pub_auth(self.opts)
                salt.daemons.masterapi.clean_proc_dir(self.opts)
            self.handle_git_pillar()
            self.handle_schedule()
            self.handle_key_cache()
            self.handle_presence(old_present)
            self.handle_key_rotate(now)
            salt.utils.verify.check_max_open_files(self.opts)
            last = now
            time.sleep(self.loop_interval)
511565
def _on_process_started(self):
        
        comm('backend process started')
        if self is None:
            return
        self.starting = False
        self.running = True
772044
def precheck():
    
    binaries = ['make']
    for bin in binaries:
        if not which(bin):
            msg = 'Dependency fail -- Unable to locate rquired binary: '
            stdout_message('%s: %s' % (msg, ACCENT + bin + RESET))
            return False
        elif not root():
            return False
    return True
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
724105
private function monitorPending()
    {
        foreach ($this->inProcess as $index => $process) {

            /** @var Process $process */
            if ($process->isTerminated()) {

                if ($process->isSuccessful()) {

                    call_user_func($this->onSuccess, $process->getOutput(), $index);

                } else {

                    call_user_func($this->onError, $process->getErrorOutput(), $index);
                }

                unset($this->inProcess[$index]);

                $this->addPending();
            }
        }
    }
505147
def is_running(self):
        

        if self._process:
            if self._process.returncode is None:
                return True
            else:
                self._process = None
        return False
128497
private function checkStatus()
    {
        if (!$this->running) {
            return;
        }

        if ($this->running) {
            foreach (proc_get_status($this->resource) as $key => $value) {
                if ($key == 'command') {
                    continue;
                }

                $this->$key = $value;
            }
        }

        if (!$this->running) {
            $this->cleanup();
        }
    }
1061991
def run(self):
        

        self._systemd_notify_once()
        self._child_supervisor = _utils.spawn(self._child_supervisor_thread)
        self._wait_forever()
328697
public function isRunning()
    {
        $this->checkSupportingOS('Cocur\BackgroundProcess can only check if a process is running on *nix-based '.
                                 'systems, such as Unix, Linux or Mac OS X. You are running "%s".');

        try {
            $result = shell_exec(sprintf('ps %d 2>&1', $this->pid));
            if (count(preg_split("/\n/", $result)) > 2 && !preg_match('/ERROR: Process ID out of range/', $result)) {
                return true;
            }
        } catch (Exception $e) {
        }

        return false;
    }
210989
def program_checks(job, input_args):
    
    # Program checks
    for program in ['curl', 'docker', 'unzip', 'samtools']:
        assert which(program), 'Program "{}" must be installed on every node.'.format(program)
    job.addChildJobFn(download_shared_files, input_args)