Provenance¶
-
class
ctapipe.core.
Provenance
(*args, **kw)[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_file
oradd_output_file
will register files within that activity. Finish the current activity withfinish_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
returns provenence for full list of activities
Methods Summary
activity
(name)context manager for activities
add_config
(config)add configuration parameters to the current activity
add_input_file
(filename[, role])register an input to the current activity
add_output_file
(filename[, role])register an output to the current activity
as_json
(**kwargs)return all finished provenance as JSON.
clear
()remove all tracked activities
finish_activity
([status, activity_name])end the current activity
start_activity
([activity_name])push activity onto the stack
Attributes Documentation
-
active_activity_names
¶
-
current_activity
¶
-
finished_activities
¶
-
finished_activity_names
¶
-
instance
= <ctapipe.core.provenance.Provenance object>¶
-
provenance
¶ returns provenence for full list of activities
Methods Documentation
-
add_config
(config)[source]¶ add configuration parameters to the current activity
- Parameters
- config: dict
configuration parameters
-
add_input_file
(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
(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
(**kwargs)[source]¶ return all finished provenance as JSON. Kwargs for
json.dumps
may be included, e.g.indent=4
-