Location where step report is cached between sessions to
        prevent loss of display data between runs.
351280
def results_cache_path(self) -> str:
        
        if not self.project:
            return ''
        return os.path.join(
            self.project.results_path,
            '.cache',
            'steps',
            '{}.json'.format(self.id)
        )
1144039
def store(self, t, step):
        
        max_cache = int(self.system.tds.config.max_cache)
        if len(self.vars) >= max_cache > 0:
            self.dump()
            self.vars = list()
            self.t = list()
            self.k = list()
            logger.debug(
                'varout cache cleared at simulation t = {:g}.'.format(
                    self.system.dae.t))
            self._mode = 'a'

        var_data = matrix([self.system.dae.x, self.system.dae.y])

        # ===== This code block is deprecated =====
        self.t.append(t)
        self.k.append(step)
        self.vars.append(var_data)
        # =========================================

        # clear data cache if written to disk
        if self.np_nrows >= max_cache > 0:
            self.dump_np_vars()
            self.np_vars = np.zeros(self._np_block_shape)
            self.np_nrows = 0
            self.np_t = np.zeros((self._np_block_rows,))
            self.np_k = np.zeros((self._np_block_rows,))
            logger.debug(
                'np_vars cache cleared at simulation t = {:g}.'.format(
                    self.system.dae.t))
            self._mode = 'a'

        # initialize before first-time adding data
        if self.np_nrows == 0:
            self.np_ncols = len(var_data)
            self._np_block_shape = (self._np_block_rows, self.np_ncols)
            self.np_vars = np.zeros(self._np_block_shape)
            self.np_t = np.zeros((self._np_block_rows,))
            self.np_k = np.zeros((self._np_block_rows,))

        # adding data to the matrix
        # self.np_vars[self.np_nrows, 0] = t
        self.np_t[self.np_nrows] = t
        self.np_k[self.np_nrows] = step
        self.np_vars[self.np_nrows, :] = np.array(var_data).reshape((-1))
        self.np_nrows += 1

        # check if matrix extension is needed
        if self.np_nrows >= self.np_vars.shape[0]:
            self.np_vars = np.concatenate([self.np_vars, np.zeros(self._np_block_shape)], axis=0)
            self.np_t = np.concatenate([self.np_t, np.zeros((self._np_block_rows,))], axis=0)
            self.np_k = np.concatenate([self.np_k, np.zeros((self._np_block_rows,))], axis=0)

        # remove the post-computed variables from the variable list
        if self.system.tds.config.compute_flows:
            self.system.dae.y = self.system.dae.y[:self.system.dae.m]
451507
public function remove() {
        global $DB;

        if ($this->id === null) {
            return;
        }

        $DB->delete_records('tool_usertours_steps', array('id' => $this->id));
        $this->get_tour()->reset_step_sortorder();

        // Notify of a change to the step configuration.
        // This must be done separately to tour change notifications.
        cache::notify_step_change($this->get_id());

        // Notify the cache that a tour has changed.
        // Tours are only stored in the cache if there are steps.
        // If there step count has changed for some reason, this will change the potential cache results.
        cache::notify_tour_change();
    }
178835
private void retireMapUnprotected(TaskInProgress tip) {
    if (runningMaps == null) {
      LOG.warn("Running cache for maps missing!! "
               + "Job details are missing.");
      return;
    }
    runningMaps.remove(tip);
  }
261973
def store_unused_steps(names, step_defs)
      names.each do |name|
        location = step_defs.step_location_for(name).join(':')
        unused_steps[location] = name
      end
    end
739237
private void flushHotCacheSlot(SlotReference slot) {
        // Iterate over a copy to avoid concurrent modification issues
        for (Map.Entry<DeckReference, TrackMetadata> entry : new HashMap<DeckReference,TrackMetadata>(hotCache).entrySet()) {
            if (slot == SlotReference.getSlotReference(entry.getValue().trackReference)) {
                logger.debug("Evicting cached metadata in response to unmount report {}", entry.getValue());
                hotCache.remove(entry.getKey());
            }
        }
    }
31375
def report_run():
    """"""
    build = g.build
    release, run = _get_or_create_run(build)

    db.session.refresh(run, lockmode='update')

    current_url = request.form.get('url', type=str)
    current_image = request.form.get('image', type=str)
    current_log = request.form.get('log', type=str)
    current_config = request.form.get('config', type=str)

    ref_url = request.form.get('ref_url', type=str)
    ref_image = request.form.get('ref_image', type=str)
    ref_log = request.form.get('ref_log', type=str)
    ref_config = request.form.get('ref_config', type=str)

    diff_failed = request.form.get('diff_failed', type=str)
    diff_image = request.form.get('diff_image', type=str)
    diff_log = request.form.get('diff_log', type=str)

    distortion = request.form.get('distortion', default=None, type=float)
    run_failed = request.form.get('run_failed', type=str)

    if current_url:
        run.url = current_url
    if current_image:
        run.image = current_image
    if current_log:
        run.log = current_log
    if current_config:
        run.config = current_config
    if current_image or current_log or current_config:
        logging.info('Saving run data: build_id=%r, release_name=%r, '
                     'release_number=%d, run_name=%r, url=%r, '
                     'image=%r, log=%r, config=%r, run_failed=%r',
                     build.id, release.name, release.number, run.name,
                     run.url, run.image, run.log, run.config, run_failed)

    if ref_url:
        run.ref_url = ref_url
    if ref_image:
        run.ref_image = ref_image
    if ref_log:
        run.ref_log = ref_log
    if ref_config:
        run.ref_config = ref_config
    if ref_image or ref_log or ref_config:
        logging.info('Saved reference data: build_id=%r, release_name=%r, '
                     'release_number=%d, run_name=%r, ref_url=%r, '
                     'ref_image=%r, ref_log=%r, ref_config=%r',
                     build.id, release.name, release.number, run.name,
                     run.ref_url, run.ref_image, run.ref_log, run.ref_config)

    if diff_image:
        run.diff_image = diff_image
    if diff_log:
        run.diff_log = diff_log
    if distortion:
        run.distortion = distortion

    if diff_image or diff_log:
        logging.info('Saved pdiff: build_id=%r, release_name=%r, '
                     'release_number=%d, run_name=%r, diff_image=%r, '
                     'diff_log=%r, diff_failed=%r, distortion=%r',
                     build.id, release.name, release.number, run.name,
                     run.diff_image, run.diff_log, diff_failed, distortion)

    if run.image and run.diff_image:
        run.status = models.Run.DIFF_FOUND
    elif run.image and run.ref_image and not run.diff_log:
        run.status = models.Run.NEEDS_DIFF
    elif run.image and run.ref_image and not diff_failed:
        run.status = models.Run.DIFF_NOT_FOUND
    elif run.image and not run.ref_config:
        run.status = models.Run.NO_DIFF_NEEDED
    elif run_failed or diff_failed:
        run.status = models.Run.FAILED
    else:
        # NOTE: Intentionally do not transition state here in the default case.
        # We allow multiple background workers to be writing to the same Run in
        # parallel updating its various properties.
        pass

    # TODO: Verify the build has access to both the current_image and
    # the reference_sha1sum so they can't make a diff from a black image
    # and still see private data in the diff image.

    if run.status == models.Run.NEEDS_DIFF:
        task_id = '%s:%s:%s' % (run.id, run.image, run.ref_image)
        logging.info('Enqueuing pdiff task=%r', task_id)

        work_queue.add(
            constants.PDIFF_QUEUE_NAME,
            payload=dict(
                build_id=build.id,
                release_name=release.name,
                release_number=release.number,
                run_name=run.name,
                run_sha1sum=run.image,
                reference_sha1sum=run.ref_image,
            ),
            build_id=build.id,
            release_id=release.id,
            run_id=run.id,
            source='report_run',
            task_id=task_id)

    # Flush the run so querying for Runs in _check_release_done_processing
    # will be find the new run too and we won't deadlock.
    db.session.add(run)
    db.session.flush()

    _check_release_done_processing(release)
    db.session.commit()

    signals.run_updated_via_api.send(
        app, build=build, release=release, run=run)

    logging.info('Updated run: build_id=%r, release_name=%r, '
                 'release_number=%d, run_name=%r, status=%r',
                 build.id, release.name, release.number, run.name, run.status)

    return flask.jsonify(success=True)
625759
def save(self, trial, storage=Checkpoint.DISK):
        """"""
        trial._checkpoint.storage = storage
        trial._checkpoint.last_result = trial.last_result
        if storage == Checkpoint.MEMORY:
            trial._checkpoint.value = trial.runner.save_to_object.remote()
        else:
            # Keeps only highest performing checkpoints if enabled
            if trial.keep_checkpoints_num:
                try:
                    last_attr_val = trial.last_result[
                        trial.checkpoint_score_attr]
                    if (trial.compare_checkpoints(last_attr_val)
                            and not math.isnan(last_attr_val)):
                        trial.best_checkpoint_attr_value = last_attr_val
                        self._checkpoint_and_erase(trial)
                except KeyError:
                    logger.warning(
                        "Result dict has no key: {}. keep"
                        "_checkpoints_num flag will not work".format(
                            trial.checkpoint_score_attr))
            else:
                with warn_if_slow("save_to_disk"):
                    trial._checkpoint.value = ray.get(
                        trial.runner.save.remote())

        return trial._checkpoint.value
635107
final void cache(String hostname, E value, int ttl, EventLoop loop) {
        Entries entries = resolveCache.get(hostname);
        if (entries == null) {
            entries = new Entries(hostname);
            Entries oldEntries = resolveCache.putIfAbsent(hostname, entries);
            if (oldEntries != null) {
                entries = oldEntries;
            }
        }
        entries.add(value, ttl, loop);
    }
1364117
def is_step_visible(self, step):
        
        return self.idempotent_dict.get(step, True) or \
            step not in self.storage.validated_step_data
1246742
def store_session(self):
        

        session = []
        for editor in self.list_editors():
            file = editor.file
            ignore_file = True
            if editor.is_untitled and not editor.is_empty():
                file = os.path.join(self.__default_session_directory, file)
                editor.write_file(file)
            elif os.path.dirname(file) == self.__default_session_directory:
                editor.save_file()
            session.append(file)

        for directory in self.list_projects():
            if not os.path.exists(directory):
                continue

            session.append(directory)

        LOGGER.debug("> Storing session :'{0}'.".format(session))
        self.__settings.set_key(self.__settings_section, "session", session)
        return True
958523
public void deleteNoCheckFromLog(Session session, Object[] data) {

        Row             row   = null;
        PersistentStore store = session.sessionData.getRowStore(this);

        if (hasPrimaryKey()) {
            RowIterator it = getPrimaryIndex().findFirstRow(session, store,
                data, primaryKeyColsSequence);

            row = it.getNextRow();
        } else if (bestIndex == null) {
            RowIterator it = rowIterator(session);

            while (true) {
                row = it.getNextRow();

                if (row == null) {
                    break;
                }

                if (IndexAVL.compareRows(
                        row.getData(), data, defaultColumnMap,
                        colTypes) == 0) {
                    break;
                }
            }
        } else {
            RowIterator it = bestIndex.findFirstRow(session, store, data);

            while (true) {
                row = it.getNextRow();

                if (row == null) {
                    break;
                }

                Object[] rowdata = row.getData();

                // reached end of range
                if (bestIndex.compareRowNonUnique(
                        data, bestIndex.getColumns(), rowdata) != 0) {
                    row = null;

                    break;
                }

                if (IndexAVL.compareRows(
                        rowdata, data, defaultColumnMap, colTypes) == 0) {
                    break;
                }
            }
        }

        if (row == null) {
            return;
        }

        deleteNoCheck(session, row);
    }
966782
def __record_progress(self, next_step=None):
        
        config.SUSHI_BAR_CLIENT.report_progress(
            self.get_status(), self.get_status().value/Status.DONE.value)
        if next_step:
            now = time.time()
            config.SUSHI_BAR_CLIENT.report_stage(self.get_status(), now - self.timestamp)
            self.timestamp = now
            self.status = next_step
        with open(self.get_restore_path(Status.LAST), 'wb') as handle, open(self.get_restore_path(), 'wb') as step_handle:
            pickle.dump(self, handle)
            pickle.dump(self, step_handle)
101508
void checkpoint(boolean defrag) {

        if (filesReadOnly) {
            return;
        }

        database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "start");
        deleteNewAndOldFiles();
        writeScript(false);

        if (cache != null) {
            if (forceDefrag()) {
                defrag = true;
            }

            if (defrag) {
                try {
                    cache.defrag();
                } catch (Exception e) {}
            } else {
                cache.close(true);

                try {
                    cache.backupFile();
                } catch (Exception e1) {
                    deleteNewBackup();
                    cache.open(false);

                    return;
                }

                cache.open(false);
            }
        }

        properties.setDBModified(HsqlDatabaseProperties.FILES_NEW);
        closeLog();
        deleteLog();
        renameNewScript();
        renameNewBackup();
        properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED);

        if (dbLogWriter == null) {
            return;
        }

        openLog();

        Session[] sessions = database.sessionManager.getAllSessions();

/*
        try {
            for (int i = 0; i < sessions.length; i++) {
                Session session = sessions[i];

                if (session.isAutoCommit() == false) {
                    dbLogWriter.writeLogStatement(session, session.getAutoCommitStatement());
                }
            }
        } catch (IOException e) {
            throw Error.error(ErrorCode.FILE_IO_ERROR, logFileName);
        }
*/
        database.logger.appLog.logContext(SimpleLog.LOG_NORMAL, "end");
    }
752290
def cache_data(self, request, data, key='params'):
        
        request.session['%s:%s' % (constants.SESSION_KEY, key)] = data
1209957
def on_step_end(self, step, logs={}):
        
        self.total_steps += 1
        if self.total_steps % self.interval != 0:
            # Nothing to do.
            return

        filepath = self.filepath.format(step=self.total_steps, **logs)
        if self.verbose > 0:
            print('Step {}: saving model to {}'.format(self.total_steps, filepath))
        self.model.save_weights(filepath, overwrite=True)
71265
@Override
  public void checkpoint(Result<Boolean> result)
  {
    if (! _journalStream.saveStart()) {
      result.ok(true);
      return;
    }

    TableWriterService readWrite = _table.getReadWrite();
    
    // long limit = Integer.MAX_VALUE; // 128
    int tailPid = _tailPid.get();
    for (int pid = 1; pid <= tailPid; pid++) {
      Page page = _pages.get(pid);

      if (page != null) {
        page.write(_table, this, readWrite);
      }
    }

    readWrite.fsync(new CheckpointResult(result));
  }