Store metadata on this Job to the backend.
320509
def commit(self):
        
        logger.debug('Committing job {0}'.format(self.name))
        self.backend.commit_job(self._serialize())
        self.parent.commit()
741140
def save_metadata(self, data_dir, feature_name=None):
    """"""
    # Recursively save all child features
    for feature_key, feature in six.iteritems(self._feature_dict):
      if feature_name:
        feature_key = '-'.join((feature_name, feature_key))
      feature.save_metadata(data_dir, feature_name=feature_key)
272124
def store_job(opts, load, event=None, mminion=None):
    '''
    
    '''
    # Generate EndTime
    endtime = salt.utils.jid.jid_to_time(salt.utils.jid.gen_jid(opts))
    # If the return data is invalid, just ignore it
    if any(key not in load for key in ('return', 'jid', 'id')):
        return False
    if not salt.utils.verify.valid_id(opts, load['id']):
        return False
    if mminion is None:
        mminion = salt.minion.MasterMinion(opts, states=False, rend=False)

    job_cache = opts['master_job_cache']
    if load['jid'] == 'req':
        # The minion is returning a standalone job, request a jobid
        load['arg'] = load.get('arg', load.get('fun_args', []))
        load['tgt_type'] = 'glob'
        load['tgt'] = load['id']

        prep_fstr = '{0}.prep_jid'.format(opts['master_job_cache'])
        try:
            load['jid'] = mminion.returners[prep_fstr](nocache=load.get('nocache', False))
        except KeyError:
            emsg = "Returner '{0}' does not support function prep_jid".format(job_cache)
            log.error(emsg)
            raise KeyError(emsg)

        # save the load, since we don't have it
        saveload_fstr = '{0}.save_load'.format(job_cache)
        try:
            mminion.returners[saveload_fstr](load['jid'], load)
        except KeyError:
            emsg = "Returner '{0}' does not support function save_load".format(job_cache)
            log.error(emsg)
            raise KeyError(emsg)
    elif salt.utils.jid.is_jid(load['jid']):
        # Store the jid
        jidstore_fstr = '{0}.prep_jid'.format(job_cache)
        try:
            mminion.returners[jidstore_fstr](False, passed_jid=load['jid'])
        except KeyError:
            emsg = "Returner '{0}' does not support function prep_jid".format(job_cache)
            log.error(emsg)
            raise KeyError(emsg)

    if event:
        # If the return data is invalid, just ignore it
        log.info('Got return from %s for job %s', load['id'], load['jid'])
        event.fire_event(load,
                         salt.utils.event.tagify([load['jid'], 'ret', load['id']], 'job'))
        event.fire_ret_load(load)

    # if you have a job_cache, or an ext_job_cache, don't write to
    # the regular master cache
    if not opts['job_cache'] or opts.get('ext_job_cache'):
        return

    # do not cache job results if explicitly requested
    if load.get('jid') == 'nocache':
        log.debug('Ignoring job return with jid for caching %s from %s',
                  load['jid'], load['id'])
        return

    # otherwise, write to the master cache
    savefstr = '{0}.save_load'.format(job_cache)
    getfstr = '{0}.get_load'.format(job_cache)
    fstr = '{0}.returner'.format(job_cache)
    updateetfstr = '{0}.update_endtime'.format(job_cache)
    if 'fun' not in load and load.get('return', {}):
        ret_ = load.get('return', {})
        if 'fun' in ret_:
            load.update({'fun': ret_['fun']})
        if 'user' in ret_:
            load.update({'user': ret_['user']})

    # Try to reach returner methods
    try:
        savefstr_func = mminion.returners[savefstr]
        getfstr_func = mminion.returners[getfstr]
        fstr_func = mminion.returners[fstr]
    except KeyError as error:
        emsg = "Returner '{0}' does not support function {1}".format(job_cache, error)
        log.error(emsg)
        raise KeyError(emsg)

    if job_cache != 'local_cache':
        try:
            mminion.returners[savefstr](load['jid'], load)
        except KeyError as e:
            log.error("Load does not contain 'jid': %s", e)

    mminion.returners[fstr](load)

    if (opts.get('job_cache_store_endtime')
            and updateetfstr in mminion.returners):
        mminion.returners[updateetfstr](load['jid'], endtime)
1004550
def metadata(self):
        """"""
        output = dict(self.defaults)
        output.update(self.extra_metadata)
        return output
1084813
def generatemetadata(self, parameters, parentfile, relevantinputfiles, provenancedata = None):
        """"""
        assert isinstance(provenancedata,CLAMProvenanceData) or provenancedata is None

        data = {}

        if self.copymetadata:
            #Copy parent metadata
            for key, value in parentfile.metadata.items():
                data[key] = value

        for metafield in self.metafields:
            if isinstance(metafield, ParameterCondition):
                metafield = metafield.evaluate(parameters)
                if not metafield:
                    continue
            assert isinstance(metafield, AbstractMetaField)
            metafield.resolve(data, parameters, parentfile, relevantinputfiles)

        if provenancedata:
            data['provenance'] = provenancedata

        return self.formatclass(None, **data)
1272570
def save_metadata_json(self, filename: str, structure: JsonExportable) -> None:
        """"""
        if self.compress_json:
            filename += '.json.xz'
        else:
            filename += '.json'
        save_structure_to_file(structure, filename)
        if isinstance(structure, (Post, StoryItem)):
            # log 'json ' message when saving Post or StoryItem
            self.context.log('json', end=' ', flush=True)
594374
def save(self):
        
        super(Samples, self).save()
        if self.metadata is not None:
            self.metadata.save()
523285
function storeMetaData(metaData, file) {
	var json
		, stream;

	try {
		json = JSON.stringify(metaData);
		stream = fs.createWriteStream(file);

		stream.write(json);
		stream.end();
	} catch(e) {
		console.error('Could not save meta data for ' + file);
	}
}
1040776
def store_stats(self):
    """"""
    stats = self._stats()

    # Write stats to user-defined json file.
    stats_json_file_name = self.get_options().stats_local_json_file
    if stats_json_file_name:
      self.write_stats_to_json(stats_json_file_name, stats)

    # Upload to remote stats db.
    stats_upload_urls = copy.copy(self.get_options().stats_upload_urls)
    timeout = self.get_options().stats_upload_timeout
    for stats_url, auth_provider in stats_upload_urls.items():
      self.post_stats(stats_url, stats, timeout=timeout, auth_provider=auth_provider)
253568
async def Save(self, metadata):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='ImageMetadata',
                   request='Save',
                   version=2,
                   params=_params)
        _params['metadata'] = metadata
        reply = await self.rpc(msg)
        return reply
710914
def save(self):
        
        if not os.path.exists(self.paths.virt()):
            os.makedirs(self.paths.virt())

        self._save_metadata()
        self.virt_env.save()
1294925
def save_metadata(hparams):
  """"""
  output_dir = os.path.expanduser(FLAGS.output_dir)
  if not tf.gfile.Exists(output_dir):
    tf.gfile.MakeDirs(output_dir)

  # Save FLAGS in txt file
  if hasattr(FLAGS, "flags_into_string"):
    flags_str = FLAGS.flags_into_string()
    t2t_flags_str = "\n".join([
        "--%s=%s" % (f.name, f.value)
        for f in FLAGS.flags_by_module_dict()["tensor2tensor.utils.flags"]
    ])
  else:
    flags_dict = FLAGS.__dict__["__flags"]
    flags_str = "\n".join(
        ["--%s=%s" % (name, str(f)) for (name, f) in flags_dict.items()])
    t2t_flags_str = None

  flags_txt = os.path.join(output_dir, "flags.txt")
  with tf.gfile.Open(flags_txt, "w") as f:
    f.write(flags_str)

  if t2t_flags_str:
    t2t_flags_txt = os.path.join(output_dir, "flags_t2t.txt")
    with tf.gfile.Open(t2t_flags_txt, "w") as f:
      f.write(t2t_flags_str)

  # Save hparams as hparams.json
  new_hparams = hparams_lib.copy_hparams(hparams)
  # Modality class is not JSON serializable so remove.
  new_hparams.del_hparam("modality")

  hparams_fname = os.path.join(output_dir, "hparams.json")
  with tf.gfile.Open(hparams_fname, "w") as f:
    f.write(new_hparams.to_json(indent=0, sort_keys=True))
405877
private function _store() {
		// Flushes the buffers
		$output = ob_get_flush();

		\wp_cache_add( $this->key, $output, $this->group, $this->expires );
	}
1218197
def store_result_in_db(self, result, always_cache=True):
        """"""
        job = self[result.key]

        def extend_dependent_links():
            with self.lock:
                new_workflow_id = id(get_workflow(result.value))
                self.links[new_workflow_id].extend(
                    self.links[id(job.workflow)])
                del self.links[id(job.workflow)]

        def store_result(status):
            result_value_msg = self.registry.to_json(result.value)
            with self.lock:
                self.cur.execute(
                    'update "jobs" set "result" = ?, '
                    '"status" = ? where "id" = ?;',
                    (result_value_msg, status, result.key))

        def acquire_links():
            with self.lock:
                linked_keys = tuple(self.links[id(job.workflow)])
                del self.links[id(job.workflow)]

                # update links for jobs up in the call-stack (parent workflows)
                n_questions = ','.join('?' * len(linked_keys))
                self.cur.execute(
                    'update "jobs" set "link" = ? where "id" in ({});'
                    .format(n_questions),
                    (result.key,) + linked_keys)

                # jobs that were attached to the parent workflow(s) will not
                # receive the current result automatically, so we need to force
                # feed them to the scheduler.
                attached_keys = ()
                for k in linked_keys:
                    attached_keys += tuple(self.attached[k])
                    del self.attached[k]

            return attached_keys

        # if the returned job is not set to be stored, but a parent job
        # is, we still need to store the result.
        if 'store' not in job.hints and not always_cache:
            if job.is_root_node and id(job.workflow) in self.links:
                if is_workflow(result.value):
                    extend_dependent_links()
                    return ()
                else:
                    store_result(Status.LINKEE)
                    return acquire_links()
            else:
                return ()

        # if the return value is a workflow, store the workflow, and add
        # links to this job, to be updated when the resolved result comes in
        if is_workflow(result.value):
            store_result(Status.WORKFLOW)
            with self.lock:
                self.links[id(get_workflow(result.value))].append(result.key)
            if job.is_root_node:
                extend_dependent_links()
            return ()

        store_result(Status.STORED)
        with self.lock:
            attached_keys = tuple(self.attached[result.key])
            del self.attached[result.key]

        if job.is_root_node:
            attached_keys += acquire_links()

        return attached_keys
1081138
def store_contents(self):
        
        string_buffer = os.linesep.join(
            map(
                lambda x: os.linesep.join(
                    ["<begin_table>"] + [x.name] + x.columns + ["<end_table>"]
                ),
                self.tables
            )
        )

        with open(METADATA_FILE, "w") as f:
            f.write(string_buffer)

        for i in self.tables:
            i.store_contents()
7211
def upload(self, *args, **kwargs):
    """"""
    for job in self.jobs:
      job.upload(*args, **kwargs)
701331
protected function setup_metadata() {
		if ( ! $this->meta_type ) {
			return;
		}

		$metadata = $this->get_metadata();
		foreach ( $this->get_mapping() as $attribute => $meta ) {
			if ( isset( $metadata[ $meta ] ) ) {
				$this->set_attribute( $attribute, $metadata[ $meta ] );
			}
		}
	}