Rolls checkpointed image.
8312
private static void renameCheckpointInDir(StorageDirectory sd, long txid)
      throws IOException {
    File ckpt = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE_NEW, txid);
    File curFile = NNStorage.getStorageFile(sd, NameNodeFile.IMAGE, txid);
    // renameTo fails on Windows if the destination file 
    // already exists.
    LOG.info("Renaming  " + ckpt.getAbsolutePath() + " to "
        + curFile.getAbsolutePath());
    if (!ckpt.renameTo(curFile)) {
      if (!curFile.delete() || !ckpt.renameTo(curFile)) {
        throw new IOException("renaming  " + ckpt.getAbsolutePath() + " to "  + 
            curFile.getAbsolutePath() + " FAILED");
      }
    }    
  }
1084807
public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException
    {
        mod.doInsert();
        mod.setModificationState(StateOldClean.getInstance());
    }
664483
protected final void checkPoints() {
        if (pointsDirty) {
            createPoints();
            findCenter();
            calculateRadius();
            
            if (points.length > 0) {
	            maxX = points[0];
	            maxY = points[1];
	            minX = points[0];
	            minY = points[1];
	            for (int i=0;i<points.length/2;i++) {
	            	maxX = Math.max(points[i*2],maxX);
	            	maxY = Math.max(points[(i*2)+1],maxY);
	            	minX = Math.min(points[i*2],minX);
	            	minY = Math.min(points[(i*2)+1],minY);
	            }
            }
            pointsDirty = false;
            trianglesDirty = true;
        }
    }
491223
def on_batch_end(self, iteration:int, **kwargs)->None:
        ""
        super().on_batch_end(iteration=iteration, **kwargs)
        if iteration == 0: return
        if iteration % self.visual_iters == 0: self._write_images(iteration=iteration)
267212
def check_image_state(self, image_id, wait=True):

        '''
            
        '''

        title = '%s.check_image_state' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'image_id': image_id
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)

    # notify state check
        self.iam.printer('Querying AWS region %s for state of image %s.' % (self.iam.region_name, image_id))
        
    # check connection to API
        try:
            self.connection.describe_instances()
        except:
            raise AWSConnectionError(title)

    # check existence of image
        try:
            response = self.connection.describe_images(ImageIds=[ image_id ])
        except:
            raise ValueError('\nImage %s does not exist in your permission scope.' % image_id)
        if not 'Images' in response.keys():
            raise ValueError('\nImage %s does not exist in your permission scope.' % image_id)
        elif not response['Images'][0]:
            raise ValueError('\nImage %s does not exist in your permission scope.' % image_id)

    # check into state of image
        elif not 'State' in response['Images'][0].keys():
            from time import sleep
            from timeit import timeit as timer
            self.iam.printer('Checking into the status of image %s' % image_id, flush=True)
            state_timeout = 0
            while not 'State' in response['Images'][0].keys():
                self.iam.printer('.', flush=True)
                sleep(3)
                state_timeout += 1
                response = self.connection.describe_images(
                    ImageIds=[ image_id ]
                )
                if state_timeout > 3:
                    raise Exception('\nFailure to determine status of image %s.' % image_id)
            self.iam.printer(' done.')
        image_state = response['Images'][0]['State']

    # return None if image has already been deregistered or is invalid
        if image_state == 'deregistered':
            self.iam.printer('Image %s has already been deregistered.' % image_id)
            return None
        elif image_state == 'invalid' or image_state == 'transient' or image_state == 'failed':
            self.iam.printer('Image %s is %s.' % (image_id, image_state))
            return None

    # wait while image is pending
        elif image_state == 'pending':
            self.iam.printer('Image %s is %s.' % (image_id, image_state), flush=True)
            if not wait:
                return image_state
            else:
                from time import sleep
                from timeit import timeit as timer
                delay = 3
                state_timeout = 0
                while image_state != 'available':
                    self.iam.printer('.', flush=True)
                    sleep(delay)
                    t3 = timer()
                    response = self.connection.describe_images(
                        ImageIds=[ image_id ]
                    )
                    t4 = timer()
                    state_timeout += 1
                    response_time = t4 - t3
                    if 3 - response_time > 0:
                        delay = 3 - response_time
                    else:
                        delay = 0
                    if state_timeout > 300:
                        raise Exception('\nTimeout. Failure initializing image %s on AWS in less than 15min' % image_id)
                    image_state = response['Images'][0]['State']
                self.iam.printer(' done.')

    # report outcome
        self.iam.printer('Image %s is %s.' % (image_id, image_state))
        
        return image_state
496496
void roll() {
        m_batchLock.writeLock().lock();
        final PeriodicExportContext previous = m_current;
        try {
            m_current = new PeriodicExportContext();

            m_logger.trace("Rolling batch.");

            for( ExportToFileDecoder decoder : m_tableDecoders.values()) {
                decoder.resetWriter();
            }

        }
        finally {
            m_batchLock.writeLock().unlock();
        }
        previous.closeAllWriters();
    }
1229483
def rollover (self):
        """"""
        rollover = False

        if not rollover and self._threshold.nbytes is not None:
            rollover = self._total.nbytes >= self._threshold.nbytes

        if not rollover and self._threshold.npackets is not None:
            rollover = self._total.npackets >= self._threshold.npackets

        if not rollover and self._threshold.nseconds is not None:
            nseconds = math.ceil(self._total.nseconds)
            rollover = nseconds >= self._threshold.nseconds

        return rollover
728417
function() {
            if (this._autocrop && this._applyAutocrop) {
                if (!this.toggleLoadingImage()) {
                    this.toggleLoadingImage(true)
                }

                if (this._image.autocrop()) {
                    this.redraw();
                }
            }

            if (this._waitForWorkers == 0) {
                this.toggleLoadingImage(false);
            }
        }
529036
protected synchronized void checkpoint(long forcedLogSequenceNumber)
                    throws ObjectManagerException
    {
        throw new InvalidStateException(this, InternalTransaction.stateTerminated, InternalTransaction.stateNames[InternalTransaction.stateTerminated]);
    }
361379
def _configure_saver(checkpoint_dir, checkpoint_interval):
  """"""
  saver = tf.train.Saver()
  return tf.train.CheckpointSaverHook(
      checkpoint_dir=checkpoint_dir,
      save_steps=checkpoint_interval,
      saver=saver)
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)
776564
function ImageLinter(ruleFilePath) {
    if (!ruleFilePath) logger.info("No rule file provided, using default rules");
    this.rules = loadRules(ruleFilePath);
    this.context = {
        rules: this.rules,
        validInstructionsRegex: helper.createValidCommandRegex(this.rules.general.valid_instructions),
        requiredInstructions: helper.createReqInstructionHash(this.rules),
        requiredNameVals: helper.createRequiredNameValDict(this.rules)
    };
    helper.initLineRulesRegexes(this.rules);
}
998934
def initialize_from_checkpoint(state):
  """"""

  # The checkpoint's work_dir should contain the most recently trained model.
  model_paths = glob.glob(os.path.join(FLAGS.checkpoint_dir,
                                       'work_dir/model.ckpt-*.pb'))
  if len(model_paths) != 1:
    raise RuntimeError('Expected exactly one model in the checkpoint work_dir, '
                       'got [{}]'.format(', '.join(model_paths)))
  start_model_path = model_paths[0]

  # Copy the latest trained model into the models directory and use it on the
  # first round of selfplay.
  state.best_model_name = 'checkpoint'
  shutil.copy(start_model_path,
              os.path.join(fsdb.models_dir(), state.best_model_name + '.pb'))

  # Copy the training chunks.
  golden_chunks_dir = os.path.join(FLAGS.checkpoint_dir, 'golden_chunks')
  for basename in os.listdir(golden_chunks_dir):
    path = os.path.join(golden_chunks_dir, basename)
    shutil.copy(path, fsdb.golden_chunk_dir())

  # Copy the training files.
  work_dir = os.path.join(FLAGS.checkpoint_dir, 'work_dir')
  for basename in os.listdir(work_dir):
    path = os.path.join(work_dir, basename)
    shutil.copy(path, fsdb.working_dir())
814051
def load_rabit_checkpoint(self):
        
        version = ctypes.c_int()
        _check_call(_LIB.XGBoosterLoadRabitCheckpoint(
            self.handle, ctypes.byref(version)))
        return version.value
1338544
def saveLastScreenImage(self):
        
        bitmap = self.getLastScreenImage()
        _, target_file = tempfile.mkstemp(".png")
        cv2.imwrite(target_file, bitmap)
605068
def syncImage(img, current, session):
    """"""
    def _img_str(i):
        return "%s - %s" % (i.type, i.description)

    for db_img in current.images:
        img_info = (img.type, img.md5, img.size)
        db_img_info = (db_img.type, db_img.md5, db_img.size)

        if db_img_info == img_info:
            img = None
            break
        elif (db_img.type == img.type and
                db_img.description == img.description):

            if img.md5 != db_img.md5:
                # Update image
                current.images.remove(db_img)
                current.images.append(img)
                session.add(current)
                pout(Fg.green("Updating image") + ": " + _img_str(img))
            img = None
            break

    if img:
        # Add image
        current.images.append(img)
        session.add(current)
        pout(Fg.green("Adding image") + ": " + _img_str(img))
1183063
def _getProcessedImage(self):
        """"""
        if self.imageDisp is None:
            self.imageDisp = self.image
            self.levelMin, self.levelMax = self._quickLevels(
                self.imageDisp)
            #list( map(float, self._quickLevels(self.imageDisp)))
        return self.imageDisp