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 thisMetaData
instance’smanifest_filehandlers
. The keys of thisdict
areFileHandler.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 thisMetaData
instance’smanifest_filehandlers
. The keys of thisdict
areFileHandler.clsname
values and the values are the corresponding sha sums. SeeFileHandler.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 thisMetaData
instance’smanifest_filehandlers
. The keys of thisdict
areFileHandler.clsname
values and the values are the corresponding sha sums computed from the subet of the input data that is actually used by thegenerate
methods of eachFileHandler
inmanifest_filehandlers
. SeeFileHandler.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 anIOError
if the metadata file does not exist and aKeyError
if thegeneration_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 aKeyError
if thegeneration_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 anIOError
if the metadata file does not exist and aKeyError
if thewall_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 callingFileHandler
; the exception is thewall_time
, i.e. time spent generating this output file; this value must be provided as an argument.
-
property
-
class
llama.meta.
MetaDataMixin
¶ Bases:
object
Add a
meta
class to an object along with a checkin decorator.-
static
decorate_checkin
(func)¶ Copy metadata from the temporary generation directory to the parent directory as part of checkin.
-
static
decorate_generate
(func)¶ Record generation wall time and other metadata for a successful generation attempt.
-
property
meta
¶ Metadata for this file produced during automated generation attempts.
-
static