Restore from a checkpoint.
340256
def restore_checkpoint(ckpt_dir, saver, sess, must_restore=False):
  """"""
  ckpt = tf.train.get_checkpoint_state(ckpt_dir)
  if must_restore and not ckpt:
    raise ValueError("No checkpoint found in %s" % ckpt_dir)
  if not ckpt:
    return 0

  path = ckpt.model_checkpoint_path
  tf.logging.info("Restoring checkpoint %s", path)
  saver.restore(sess, path)
  step = int(path.split("-")[-1])
  return step
175399
def restorecon(path, recursive=False):
    '''
    
    '''
    if recursive:
        cmd = ['restorecon', '-FR', path]
    else:
        cmd = ['restorecon', '-F', path]
    return not __salt__['cmd.retcode'](cmd, python_shell=False)
367651
def _start_trial(self, trial, checkpoint=None):
        
        prior_status = trial.status
        self.set_status(trial, Trial.RUNNING)
        trial.runner = self._setup_runner(
            trial,
            reuse_allowed=checkpoint is not None
            or trial._checkpoint.value is not None)
        if not self.restore(trial, checkpoint):
            if trial.status == Trial.ERROR:
                raise RuntimeError(
                    "Restore from checkpoint failed for Trial {}.".format(
                        str(trial)))

        previous_run = self._find_item(self._paused, trial)
        if (prior_status == Trial.PAUSED and previous_run):
            # If Trial was in flight when paused, self._paused stores result.
            self._paused.pop(previous_run[0])
            self._running[previous_run[0]] = trial
        else:
            self._train(trial)
1084807
public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException
    {
        mod.doInsert();
        mod.setModificationState(StateOldClean.getInstance());
    }
1369748
protected function doRestoreDB() {
		if ($this->Pipeline()->SkipSnapshot) return false;

		return $this->getConfigSetting('RestoreDB') && $this->Pipeline()->PreviousSnapshot();
	}
263739
def restore_backup(self, backup, name, flavor, volume):
        
        return self._manager.restore_backup(backup, name, flavor, volume)
913055
def acquire_restore(lock, state):
    """"""
    if hasattr(lock, '_acquire_restore'):
        lock._acquire_restore(state)
    elif hasattr(lock, 'acquire'):
        lock.acquire()
    else:
        raise TypeError('expecting Lock/RLock')
1175642
def restore(source, offset):
    
    backup_location = os.path.join(
        os.path.dirname(os.path.abspath(source)), source + '.bytes_backup')
    click.echo('Reading backup from: {location}'.format(location=backup_location))

    if not os.path.isfile(backup_location):
        click.echo('No backup found for: {source}'.format(source=source))
        return

    with open(backup_location, 'r+b') as b:
        data = b.read()

    click.echo('Restoring {c} bytes from offset {o}'.format(c=len(data), o=offset))
    with open(source, 'r+b') as f:
        f.seek(offset)
        f.write(data)
        f.flush()

    click.echo('Changes written')
1354970
def reset(self):
        
        self.stack.append(Frame(src=None, src_path=None))
        return Close(functools.partial(self.restore))
820551
def advance_to_checkpoint(self, checkpoint):
        
        if checkpoint in self._checkpoints:
            for cp in self._checkpoints:
                self.insert(cp)
                if cp == checkpoint:
                    return cp
        else:
            raise InvalidCheckpointError(checkpoint)
55340
def do(self):
        
        self.restore_point = self.obj.copy()
        return self.do_method(self.obj, *self.args)
173255
private void restore() {
    Preferences pref = Preferences
        .userNodeForPackage(ConnectionDialog.class);

    getHostField().setText(pref.get("host", "localhost"));
    getUserField().setText(pref.get("user", "guest"));

    boolean remember = pref.getBoolean("remember", false);
    boolean passwordSet = false;
    getRememberPasswordCheckBox().setSelected(remember);
    if (remember) {
      byte[] cipherText = pref.getByteArray("password", null);
      if (cipherText != null) {
        try {
          Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
          KeyGenerator keygen = KeyGenerator.getInstance("AES");
          SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
          random.setSeed(new byte[]{
            0x60, (byte) 0xFD, 0x28, 0x07, 0x35, 0x4A, 0x0D, 0x3B
          });
          byte[] iv = new byte[16];
          random.nextBytes(iv);
          IvParameterSpec spec = new IvParameterSpec(iv);
          keygen.init(128, random);
          cipher.init(Cipher.DECRYPT_MODE, keygen.generateKey(), spec);
          byte[] clearText = cipher.doFinal(cipherText);
          String password = new String(clearText);
          getPasswordField().setText(password);
          passwordSet = true;
        } catch (Exception e) {
          logger.error("Could not decrypt password", e);
        }
      }
    }
    if (!passwordSet) {
      getPasswordField().setText("");
    }
  }
116573
public function restore()
	{
		$this->getFilesystem()->put(app_path() . '/database/seeds/DatabaseSeeder.php', $this->getCopied());

		$this->getFilesystem()->delete(app_path() . '/database/seeds/DatabaseSeeder.old');
	}
894999
def _restoreDPFromArchive(self):
        """"""
        dp = self._dp_menu_on
        if dp and dp.archived:
            dp.restore_from_archive(parent=self)
80803
def verify(backup_path, fast):
    """"""
    from PyHardLinkBackup.phlb.verify import verify_backup

    verify_backup(backup_path, fast)
1070728
def Restore(cls, state):
        """"""

        target = SlotIdentifier.FromString(state.get('target'))
        data = base64.b64decode(state.get('data'))
        var_id = state.get('var_id')
        valid = state.get('valid')

        return ConfigEntry(target, var_id, data, valid)
1062907
def restore(self):
        
        url = self.build_url(
            self._endpoints.get('restore').format(id=self.object_id))

        response = self.con.post(url)

        return bool(response)