llama.meta module

Tools for dealing with metadata of FileHandlers.

class llama.meta.MetaData(eventdir, manifest_filehandlers)

Bases: llama.classes.RiderFile, llama.classes.JsonRiderMixin

A class for getting metadata about the output file of a FileHandler and determining things like file obsolescence.

property checksums

Read the stored sha256 checksums of the contents of this MetaData instance’s manifest_filehandlers. The keys of this dict are FileHandler.clsname values and the values are the corresponding checksums.

Raises
  • FileNotFoundError – If the metadata file does not exist.

  • KeyError – If the file format of the metadata files has changed and they do not contain the hash data.

  • IOError – If the checksums have not been computed for all files in the manifest.

property dep_checksums

Read the stored sha256 sums of the contents of the input files (i.e. DEPENDENCIES) for this MetaData instance’s manifest_filehandlers. The keys of this dict are FileHandler.clsname values and the values are the corresponding sha sums. See FileHandler.dep_checksums return values for details and use cases.

Raises
  • FileNotFoundError – If the metadata file does not exist.

  • KeyError – If the file format of the metadata files has changed and they do not contain the hash data.

property dep_subset_checksums

Read the stored sha256 sums of the subset of the contents of the input files (i.e. DEPENDENCIES) for this MetaData instance’s manifest_filehandlers. The keys of this dict are FileHandler.clsname values and the values are the corresponding sha sums computed from the subet of the input data that is actually used by the generate methods of each FileHandler in manifest_filehandlers. See FileHandler.dep_checksums return values for details and use cases.

Raises
  • FileNotFoundError – If the metadata file does not exist.

  • KeyError – If the file format of the metadata files has changed and they do not contain the hash data.

property flags

Return a dictionary of the flags defined for this event at the time when the file was generated.

property generation_time

Get the datetime object representing the UTC time at which this file was generated according to its rider metadata file. Raises an IOError if the metadata file does not exist and a KeyError if the generation_time information is not present in the metadata file.

property generation_uuid

Get a UUID for this generation event. Raises an IOError if the metadata file does not exist and a KeyError if the generation_uuid information is not present in the metadata file.

rider_fmt = '.{}.metadata.json'
property wall_time

Time in seconds spent running _generate to make this file. Raises an IOError if the metadata file does not exist and a KeyError if the wall_time information is not present in the metadata file.

write(wall_time)

Write a metadata file for this FileHandler. Almost all metadata about a generation attempt can be determined from either the LLAMA execution context or the calling FileHandler; the exception is the wall_time, i.e. time spent generating this output file; this value must be provided as an argument.