thepipe.provenance

Provenance tracking inspired by the ctapipe approach.

Module Contents

thepipe.provenance.ENV_VARS_TO_LOG = ['PATH', 'LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'USER', 'HOME', 'SHELL', 'VIRTUAL_ENV', 'CONDA_DEFAULT_ENV', 'CONDA_PREFIX', 'CONDA_EXE', 'CONDA_PROMOMPT_MODIFIER', 'CONDA_SHLVL'][source]
thepipe.provenance.ENV_VARS_IN_CI_TO_LOG = ['APPVEYOR', 'CI', 'CIRCLECI', 'CONTINUOUS_INTEGRATION', 'GITHUB_ACTIONS', 'GITLAB_CI', 'TF_BUILD', 'TRAVIS'][source]
thepipe.provenance.log[source]
thepipe.provenance.python_packages()[source]

All installed Python packages.

LRU cached, assuming no package installations during runtime.

class thepipe.provenance.Singleton[source]

Bases: type

Singleton metaclass

instance[source]
class thepipe.provenance.Provenance[source]

The provenance manager.

property outfile(self)[source]
start_activity(self, name)[source]

Starts a new activity and returns its UUID for future reference

finish_activity(self, uuid, status='completed')[source]

Finishes an activity with the given UUID

record_configuration(self, configuration)[source]

Record configuration parameters (e.g. of the pipeline)

record_input(self, url, comment='')[source]
record_output(self, url, comment='')[source]
property current_activity(self)[source]
activity(self, name)[source]
property provenance(self)[source]
property backlog(self)[source]
as_json(self, **kwargs)[source]

Dump provenance as JSON string. kwargs are passed to json.dumps

reset(self)[source]
thepipe.provenance.isotime(timestamp)[source]

ISO 8601 formatted date in UTC from unix timestamp

thepipe.provenance.now()[source]

Returns the ISO 8601 formatted time in UTC

thepipe.provenance.system_state()[source]
thepipe.provenance.system_provenance()[source]

Provenance information of the system configuration

thepipe.provenance.duration(start, stop)[source]

Return the duration in seconds between two ISO 8601 time strings in