Create a salt master worker process :param dict opts: The salt options :param dict mkey: The user running the salt master and the RSA key :param dict key: The user running the salt master and the AES key :param str pool_name: Name of the worker pool this wor
(
self, opts, mkey, key, req_channels, pool_name=None, pool_index=None, **kwargs
)
| 1834 | """ |
| 1835 | |
| 1836 | def __init__( |
| 1837 | self, opts, mkey, key, req_channels, pool_name=None, pool_index=None, **kwargs |
| 1838 | ): |
| 1839 | """ |
| 1840 | Create a salt master worker process |
| 1841 | |
| 1842 | :param dict opts: The salt options |
| 1843 | :param dict mkey: The user running the salt master and the RSA key |
| 1844 | :param dict key: The user running the salt master and the AES key |
| 1845 | :param str pool_name: Name of the worker pool this worker belongs to |
| 1846 | :param int pool_index: Index of this worker within its pool |
| 1847 | |
| 1848 | :rtype: MWorker |
| 1849 | :return: Master worker |
| 1850 | """ |
| 1851 | super().__init__(**kwargs) |
| 1852 | self.opts = opts.copy() # Copy opts to avoid modifying the shared instance |
| 1853 | self.req_channels = req_channels |
| 1854 | |
| 1855 | self.mkey = mkey |
| 1856 | self.key = key |
| 1857 | self.k_mtime = 0 |
| 1858 | self.stats = collections.defaultdict(lambda: {"mean": 0, "runs": 0}) |
| 1859 | self.stat_clock = time.time() |
| 1860 | |
| 1861 | # Pool-specific attributes |
| 1862 | self.pool_name = pool_name or "default" |
| 1863 | self.pool_index = pool_index if pool_index is not None else 0 |
| 1864 | |
| 1865 | # We need __setstate__ and __getstate__ to also pickle 'SMaster.secrets'. |
| 1866 | # Otherwise, 'SMaster.secrets' won't be copied over to the spawned process |