Load persistence file and schedule saving of persistence file.
339262
def start_persistence(self):
        """"""
        if not self.persistence:
            return
        self.persistence.safe_load_sensors()
        self.persistence.schedule_save_sensors()
289942
def persist(self):
        '''
        
        '''
        config_dir = self.opts.get('conf_dir', None)
        if config_dir is None and 'conf_file' in self.opts:
            config_dir = os.path.dirname(self.opts['conf_file'])
        if config_dir is None:
            config_dir = salt.syspaths.CONFIG_DIR

        minion_d_dir = os.path.join(
            config_dir,
            os.path.dirname(self.opts.get('default_include',
                                          salt.config.DEFAULT_MINION_OPTS['default_include'])))

        if not os.path.isdir(minion_d_dir):
            os.makedirs(minion_d_dir)

        schedule_conf = os.path.join(minion_d_dir, '_schedule.conf')
        log.debug('Persisting schedule')
        schedule_data = self._get_schedule(include_pillar=False,
                                           remove_hidden=True)
        try:
            with salt.utils.files.fopen(schedule_conf, 'wb+') as fp_:
                fp_.write(
                    salt.utils.stringutils.to_bytes(
                        salt.utils.yaml.safe_dump(
                            {'schedule': schedule_data}
                        )
                    )
                )
        except (IOError, OSError):
            log.error('Failed to persist the updated schedule',
                      exc_info_on_loglevel=logging.DEBUG)
843697
def load_ext(self):
        """"""
        try:
            sequencemanager = hydpy.pub.sequencemanager
        except AttributeError:
            raise RuntimeError(
                'The time series of sequence %s cannot be loaded.  Firstly, '
                'you have to prepare `pub.sequencemanager` correctly.'
                % objecttools.devicephrase(self))
        sequencemanager.load_file(self)
234115
def persist(self, context):
		""""""
		
		D = self._Document
		document = context.session[self.name]
		
		D.get_collection().replace_one(D.id == document.id, document, True)
993629
public long persist(File persistFile) {
        try {
            FileOutputStream fileStream = new FileOutputStream(persistFile);
            ObjectOutputStream oStream = new ObjectOutputStream((fileStream));

            long persistVersion;
            Map<String, ChangedFile> fileListCopy;
            synchronized (this) {
                fileListCopy = (Map<String, ChangedFile>) fileList.clone();
                fileListCopy.putAll(reservedFiles);
                persistVersion = listVersion;
            }

            oStream.writeObject(fileListCopy);
            oStream.close();
            return persistVersion;
        } catch (IOException e) {
            throw new RuntimeException("Unable to persist File Changed List:" +
                                       e.getMessage(), e);
        }
    }
97271
private function loadResources()
    {
        if ($this->class !== null && $this->classFilterSet === false) {
            $this->addClassFilter();
        }

        /** @var common_persistence_SqlPersistence $persistence */
        $persistence = $this->getModel()->getPersistence();
        $platform = $persistence->getPlatForm();
        $query = $platform->getQueryBuilder()
            ->select('*')
            ->from('statements')
            ->andWhere('id > ' . $this->lastId)
            ->orderBy('id');

        if ($this->cacheSize > 0) {
            $query->setMaxResults($this->cacheSize);
        }

        $query = $this->filter->applyFilters($query);
        $results = $query->execute();

        if ($this->cacheSize > 0) {
            $this->endOfClass = $results->rowCount() < $this->cacheSize;
        }

        foreach ($results->fetchAll() as $result) {
            $this->resources[] = $result;
            $this->lastId = $result['id'] > $this->lastId ? $result['id'] : $this->lastId;
        }
    }
1314232
def persist(self):
        """"""
        # In dryrun mode, without wandb run, we don't
        # save config  on initial load, because the run directory
        # may not be created yet (because we don't know if we're
        # being used in a run context, or as an API).
        # TODO: Defer saving somehow, maybe via an events system
        path = self._config_path()
        if path is None:
            return
        with open(path, "w") as conf_file:
            conf_file.write(str(self))
58244
def store(self, installed_stuff, metadata, interpreter, options):
        """"""
        new_content = {
            'timestamp': int(time.mktime(time.localtime())),
            'installed': installed_stuff,
            'metadata': metadata,
            'interpreter': interpreter,
            'options': options
        }
        logger.debug("Storing installed=%s metadata=%s interpreter=%s options=%s",
                     installed_stuff, metadata, interpreter, options)
        with filelock(self.lockpath):
            self._write_cache([json.dumps(new_content)], append=True)
509509
def save_load(jid, load, minions=None):
    '''
    
    '''
    conn, mdb = _get_conn(ret=None)
    to_save = _safe_copy(load)

    if PYMONGO_VERSION > _LooseVersion('2.3'):
        #using .copy() to ensure original data for load is unchanged
        mdb.jobs.insert_one(to_save)
    else:
        mdb.jobs.insert(to_save)
859727
def _make_persistent(self, model_name, pkg_name):
        """"""

        #
        # WARNING: ugly piece of monkey-patching below. Hopefully will replace
        # with native bravado-core code in the future...
        #

        # Load class at path pkg_name
        c = get_function(pkg_name)
        for name in ('load_from_db', 'save_to_db'):
            if not hasattr(c, name):
                raise PyMacaronCoreException("Class %s has no static method '%s'" % (pkg_name, name))

        log.info("Making %s persistent via %s" % (model_name, pkg_name))

        # Replace model generator with one that adds 'save_to_db' to every instance
        model = getattr(self.model, model_name)
        n = self._wrap_bravado_model_generator(model, c.save_to_db, pkg_name)
        setattr(self.model, model_name, n)

        # Add class method load_from_db to model generator
        model = getattr(self.model, model_name)
        setattr(model, 'load_from_db', c.load_from_db)
43918
def load(app, verbose, replay, exp_config=None):
    
    if replay:
        exp_config = exp_config or {}
        exp_config["replay"] = True
    log(header, chevrons=False)
    loader = LoaderDeployment(app, Output(), verbose, exp_config)
    loader.run()
953263
static void loadLibrary() {
    try {
      File dir = Files.createTempDirectory("libjsass-").toFile();
      dir.deleteOnExit();

      if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
        System.load(saveLibrary(dir, "sass"));
      }

      System.load(saveLibrary(dir, "jsass"));
    } catch (Exception exception) {
      LOG.warn(exception.getMessage(), exception);
      throw new LoaderException(exception);
    }
  }
680159
def reload_():
    '''
    
    '''

    ret = {'comment': [],
           'result': True}

    # If there a schedule defined in pillar, refresh it.
    if 'schedule' in __pillar__:
        out = __salt__['event.fire']({}, 'pillar_refresh')
        if out:
            ret['comment'].append('Reloaded schedule from pillar on minion.')
        else:
            ret['comment'].append('Failed to reload schedule from pillar on minion.')
            ret['result'] = False

    # move this file into an configurable opt
    sfn = '{0}/{1}/schedule.conf'.format(__opts__['config_dir'], os.path.dirname(__opts__['default_include']))
    if os.path.isfile(sfn):
        with salt.utils.files.fopen(sfn, 'rb') as fp_:
            try:
                schedule = salt.utils.yaml.safe_load(fp_)
            except salt.utils.yaml.YAMLError as exc:
                ret['comment'].append('Unable to read existing schedule file: {0}'.format(exc))

        if schedule:
            if 'schedule' in schedule and schedule['schedule']:
                out = __salt__['event.fire']({'func': 'reload', 'schedule': schedule}, 'manage_schedule')
                if out:
                    ret['comment'].append('Reloaded schedule on minion from schedule.conf.')
                else:
                    ret['comment'].append('Failed to reload schedule on minion from schedule.conf.')
                    ret['result'] = False
            else:
                ret['comment'].append('Failed to reload schedule on minion.  Saved file is empty or invalid.')
                ret['result'] = False
        else:
            ret['comment'].append('Failed to reload schedule on minion.  Saved file is empty or invalid.')
            ret['result'] = False
    return ret
150077
def load(self):
        """"""

        # Config files prior to 0.2.4 dor not have config version keys
        old_config = not self.cfg_file.Exists("config_version")

        # Reset data
        self.data.__dict__.update(self.defaults.__dict__)

        for key in self.defaults.__dict__:
            if self.cfg_file.Exists(key):
                setattr(self.data, key, self.cfg_file.Read(key))

        # Reset keys that should be reset on version upgrades
        if old_config or self.version != self.data.config_version:
            for key in self.reset_on_version_change:
                setattr(self.data, key, getattr(DefaultConfig(), key))
            self.data.config_version = self.version

        # Delete gpg_key_uid and insert fingerprint key

        if hasattr(self.data, "gpg_key_uid"):
            oldkey = "gpg_key_uid"
            delattr(self.data, oldkey)
            newkey = "gpg_key_fingerprint"
            setattr(self.data, newkey, getattr(DefaultConfig(), newkey))
444053
def persist(self, path_to_file):
        
        with open(path_to_file, 'wb') as f:
            f.write(self.data)
1138984
public void run() {
        while (continueBackup) {
            if (changedListVersion < changedList.getVersion()) {
                cleanupBackupDir(SAVED_BACKUPS);
                String filename = String.valueOf(System.currentTimeMillis());
                File persistFile = new File(backupDir, filename);
                backingUp = true;
                changedListVersion = changedList.persist(persistFile);
                backingUp = false;
            }

            sleepAndCheck(backupFrequency);
        }
    }
149824
def do_load(self, filename):
        """"""
        try:
            self.__session.load(filename)
        except IOError as e:
            self.logger.error(e.strerror)