MCPcopy Index your code
hub / github.com/saltstack/salt / restart_process

Method restart_process

salt/utils/process.py:563–593  ·  view source on GitHub ↗

Create new process (assuming this one is dead), then remove the old one

(self, pid)

Source from the content-addressed store, hash-verified

561 return process
562
563 def restart_process(self, pid):
564 """
565 Create new process (assuming this one is dead), then remove the old one
566 """
567 if self._restart_processes is False:
568 return
569 exit = self._process_map[pid]["Process"].exitcode
570 if exit > 0:
571 log.info(
572 "Process %s (%s) died with exit status %s, restarting...",
573 self._process_map[pid]["tgt"],
574 pid,
575 self._process_map[pid]["Process"].exitcode,
576 )
577 else:
578 log.debug(
579 "Process %s (%s) died with exit status %s, restarting...",
580 self._process_map[pid]["tgt"],
581 pid,
582 self._process_map[pid]["Process"].exitcode,
583 )
584 # don't block, the process is already dead
585 self._process_map[pid]["Process"].join(1)
586
587 self.add_process(
588 self._process_map[pid]["tgt"],
589 self._process_map[pid]["args"],
590 self._process_map[pid]["kwargs"],
591 )
592
593 del self._process_map[pid]
594
595 def stop_restarting(self):
596 self._restart_processes = False

Callers 1

check_childrenMethod · 0.95

Calls 3

add_processMethod · 0.95
debugMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected