Provenance

class ctapipe.core.Provenance[source]

Bases: object

Manage the provenance info for a stack of activities

use start_activity(name) to start an activity. Any calls to add_input_entity() or add_output_entity() will register files within that activity. Finish the current activity with finish_activity().

Nested activities are allowed, and handled as a stack. The final output is not hierarchical, but a flat list of activities (however hierarchical activities could easily be implemented if necessary)

Attributes Summary

active_activity_names

current_activity

finished_activities

finished_activity_names

provenance

returns provenence for full list of activities

Methods Summary

activity(self, name)

context manager for activities

add_config(self, config)

add configuration parameters to the current activity

add_input_file(self, filename[, role])

register an input to the current activity

add_output_file(self, filename[, role])

register an output to the current activity

as_json(self, \*\*kwargs)

return all finished provenance as JSON.

clear(self)

remove all tracked activities

finish_activity(self[, status, activity_name])

end the current activity

start_activity(self[, activity_name])

push activity onto the stack

Attributes Documentation

active_activity_names
current_activity
finished_activities
finished_activity_names
provenance

returns provenence for full list of activities

Methods Documentation

activity(self, name)[source]

context manager for activities

add_config(self, config)[source]

add configuration parameters to the current activity

Parameters
config: dict

configuration paramters

add_input_file(self, filename, role=None)[source]

register an input to the current activity

Parameters
filename: str

name or url of file

role: str

role this input file satisfies (optional)

add_output_file(self, filename, role=None)[source]

register an output to the current activity

Parameters
filename: str

name or url of file

role: str

role this output file satisfies (optional)

as_json(self, **kwargs)[source]

return all finished provenance as JSON. Kwargs for json.dumps may be included, e.g. indent=4

clear(self)[source]

remove all tracked activities

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

end the current activity

start_activity(self, activity_name='/home/travis/virtualenv/python3.6.7/bin/python')[source]

push activity onto the stack