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

Method add_process

salt/utils/process.py:524–561  ·  view source on GitHub ↗

Create a processes and args + kwargs This will deterimine if it is a Process class, otherwise it assumes it is a function

(self, tgt, args=None, kwargs=None, name=None)

Source from the content-addressed store, hash-verified

522 self._restart_processes = True
523
524 def add_process(self, tgt, args=None, kwargs=None, name=None):
525 """
526 Create a processes and args + kwargs
527 This will deterimine if it is a Process class, otherwise it assumes
528 it is a function
529 """
530 if args is None:
531 args = []
532 if kwargs is None:
533 kwargs = {}
534
535 if inspect.isclass(tgt) and issubclass(tgt, multiprocessing.Process):
536 if name is None:
537 name = getattr(tgt, "__qualname__", str(tgt))
538 kwargs["name"] = name
539 process = tgt(*args, **kwargs)
540 else:
541 if name is None:
542 name = getattr(tgt, "__qualname__", str(tgt))
543 process = Process(target=tgt, args=args, kwargs=kwargs, name=name)
544
545 process.register_finalize_method(cleanup_finalize_process, args, kwargs)
546
547 if isinstance(process, SignalHandlingProcess):
548 with default_signals(signal.SIGINT, signal.SIGTERM):
549 process.start()
550 else:
551 process.start()
552
553 log.debug("Started '%s' with pid %s", process.name, process.pid)
554 self._process_map[process.pid] = {
555 "tgt": tgt,
556 "args": args,
557 "kwargs": kwargs,
558 "Process": process,
559 }
560
561 return process
562
563 def restart_process(self, pid):
564 """

Callers 15

restart_processMethod · 0.95
test_basicMethod · 0.95
test_killMethod · 0.95
test_restartingMethod · 0.95
test_counterMethod · 0.95
startMethod · 0.45
__bindMethod · 0.45
runMethod · 0.45
pre_forkMethod · 0.45
pre_forkMethod · 0.45

Calls 5

default_signalsFunction · 0.85
debugMethod · 0.80
ProcessClass · 0.70
startMethod · 0.45

Tested by 6

test_basicMethod · 0.76
test_killMethod · 0.76
test_restartingMethod · 0.76
test_counterMethod · 0.76