Execute the function in a multiprocess and return the event tag to use to watch for the return
(self, fun, low, user="UNKNOWN", pub=None, local=True)
| 582 | return {"tag": tag, "jid": jid} |
| 583 | |
| 584 | def asynchronous(self, fun, low, user="UNKNOWN", pub=None, local=True): |
| 585 | """ |
| 586 | Execute the function in a multiprocess and return the event tag to use |
| 587 | to watch for the return |
| 588 | """ |
| 589 | if local: |
| 590 | proc_func = self._proc_function |
| 591 | else: |
| 592 | proc_func = self._proc_function_remote |
| 593 | async_pub = pub if pub is not None else self._gen_async_pub() |
| 594 | if salt.utils.platform.spawning_platform(): |
| 595 | instance = None |
| 596 | else: |
| 597 | instance = self |
| 598 | with salt.utils.process.default_signals(signal.SIGINT, signal.SIGTERM): |
| 599 | proc = salt.utils.process.SignalHandlingProcess( |
| 600 | target=proc_func, |
| 601 | name="ProcessFunc({}, fun={} jid={})".format( |
| 602 | proc_func.__qualname__, fun, async_pub["jid"] |
| 603 | ), |
| 604 | kwargs=dict( |
| 605 | instance=instance, |
| 606 | opts=self.opts, |
| 607 | fun=fun, |
| 608 | low=low, |
| 609 | user=user, |
| 610 | tag=async_pub["tag"], |
| 611 | jid=async_pub["jid"], |
| 612 | ), |
| 613 | ) |
| 614 | proc.start() |
| 615 | proc.join() # MUST join, otherwise we leave zombies all over |
| 616 | return async_pub |
| 617 | |
| 618 | def print_async_event(self, suffix, event): |
| 619 | """ |