def _load_modules(self):
        if self.grain_time.value is None:
            self.grain_time.value = 0.0
        # if this is a *nix system AND modules_max_memory is set, lets enforce
        # a memory limit on module imports
        # this feature ONLY works on *nix like OSs (resource module doesn't work on windows)
        modules_max_memory = False
        if self.opts.value.get('modules_max_memory', -1) > 0 and HAS_PSUTIL and HAS_RESOURCE:
            log.debug(
                    'modules_max_memory set, enforcing a maximum of {0}'.format(
                        self.opts.value['modules_max_memory'])
                    )
            modules_max_memory = True
            old_mem_limit = resource.getrlimit(resource.RLIMIT_AS)
            rss, vms = psutil.Process(os.getpid()).memory_info()
            mem_limit = rss + vms + self.opts.value['modules_max_memory']
            resource.setrlimit(resource.RLIMIT_AS, (mem_limit, mem_limit))
        elif self.opts.value.get('modules_max_memory', -1) > 0:
            if not HAS_PSUTIL:
                log.error('Unable to enforce modules_max_memory because psutil is missing')
            if not HAS_RESOURCE:
                log.error('Unable to enforce modules_max_memory because resource is missing')

        if time.time() - self.grain_time.value > 300.0 or self.module_refresh.value:
            self.opts.value['grains'] = salt.loader.grains(self.opts.value)
            self.grain_time.value = time.time()
            self.grains.value = self.opts.value['grains']
        self.utils.value = salt.loader.utils(self.opts.value)
        self.modules.value = salt.loader.minion_mods(self.opts.value, utils=self.utils.value)
        self.returners.value = salt.loader.returners(self.opts.value, self.modules.value)
        self.module_executors.value = salt.loader.executors(self.opts.value, self.modules.value)

        self.utils.value.clear()
        self.modules.value.clear()
        self.returners.value.clear()
        self.module_executors.value.clear()

        # we're done, reset the limits!
        if modules_max_memory is True:
            resource.setrlimit(resource.RLIMIT_AS, old_mem_limit)
        self.module_refresh.value = False
Fast lookup of value from 1-dimensional ndarray. Only use this if you
dataset/ETHPy150Open saltstack/salt/salt/daemons/flo/core.py/SaltLoadModules._load_modules--crossover with--dataset/ETHPy150Open pydata/pandas/pandas/tseries/index.py/DatetimeIndex.get_value