Run this method in a multiprocess target to execute the function locally and fire the return data on the event bus
(
cls,
*,
instance,
opts,
fun,
low,
user,
tag,
jid,
daemonize=True,
full_return=False,
)
| 518 | |
| 519 | @classmethod |
| 520 | def _proc_function( |
| 521 | cls, |
| 522 | *, |
| 523 | instance, |
| 524 | opts, |
| 525 | fun, |
| 526 | low, |
| 527 | user, |
| 528 | tag, |
| 529 | jid, |
| 530 | daemonize=True, |
| 531 | full_return=False, |
| 532 | ): |
| 533 | """ |
| 534 | Run this method in a multiprocess target to execute the function |
| 535 | locally and fire the return data on the event bus |
| 536 | """ |
| 537 | if daemonize and not salt.utils.platform.spawning_platform(): |
| 538 | # Shutdown logging before daemonizing |
| 539 | salt._logging.shutdown_logging() |
| 540 | salt.utils.process.daemonize() |
| 541 | # Because we have daemonized, salt._logging.in_mainprocess() will |
| 542 | # return False. We'll just force it to return True for this |
| 543 | # particular case so that proper logging can be set up. |
| 544 | salt._logging.in_mainprocess.__pid__ = os.getpid() |
| 545 | # Configure logging once daemonized |
| 546 | salt._logging.setup_logging() |
| 547 | |
| 548 | if instance is None: |
| 549 | instance = cls(opts) |
| 550 | |
| 551 | # pack a few things into low |
| 552 | low["__jid__"] = jid |
| 553 | low["__user__"] = user |
| 554 | low["__tag__"] = tag |
| 555 | |
| 556 | return instance.low(fun, low, full_return=full_return) |
| 557 | |
| 558 | def cmd_async(self, low): |
| 559 | """ |
no test coverage detected