Setup
Before using the library, the user must set up the yProv4ML execution, as well as library specific configurations:
yprov4ml.start_run(
experiment_name: str,
prov_user_namespace: Optional[str] = None,
provenance_save_dir: Optional[str] = None,
collect_all_processes: Optional[bool] = False,
save_after_n_logs: Optional[int] = 100,
rank : Optional[int] = None,
metrics_file_type: str = "csv",
csv_separator : str = ",",
use_compressor: Optional[Union[CompressorType, bool]] = None,
use_run_id: Optional[int] = None,
)
The parameters are as follows:
| Parameter | Type | Description |
|---|---|---|
experiment_name | string | Required. Name of the experiment |
prov_user_namespace | string | Optional. User namespace for the provenance graph |
provenance_save_dir | string | Optional. Directory to save the provenance graph |
collect_all_processes | bool | Optional. Whether to collect all processes |
save_after_n_logs | int | Optional. Save the graph after n logs |
rank | int | Optional. Rank of the process |
metrics_file_type | str | Optional. File format in which to save metrics: "csv" (default), "zarr" or "netcdf" |
csv_separator | str | Optional. Separator used if metrics_file_type is MetricsType.CSV. |
use_compressor | Optional[Union[CompressorType, bool]] | Optional. Compressor used for the run (CompressorType.ZIP, BLOSC_ZSTD, LZ4). BLOSC_ZSTD and LZ4 only apply to "zarr" metrics. If None, no compression is applied. |
use_run_id | Optional[int] | Optional. Explicit run id to use instead of an auto-incremented one. |
prov_user_namespace is a required string that defines the namespace under which all provenance data will be grouped. It helps in logically separating and organizing data across different users or projects, ensuring that the provenance graph remains structured and easily navigable.
collect_all_processes: A boolean flag that, when set to True, enables the collection of provenance data from all processes, which is particularly useful in multi-processing or distributed computing environments. By default, this is False, meaning only the main process (at rank 0) will be monitored unless otherwise specified.
save_after_n_logs: An optional integer that determines how frequently the provenance graph should be saved based on the number of logs collected. For example, if set to 100, the graph will be saved every 100 logs. This is essentially a caching system, which balances between execution time and RAM usage.
rank: This optional integer is used in distributed settings to specify the rank or ID of the currently collecting process. Leaving this parameter empty and collect_all_processes to False implies that only the process at rank 0 will collect data.
Note (4.0):
disable_codecarbonandunify_experimentswere removed, andlog_carbon_metricsno longer exists. Energy and power are reported bylog_system_metrics.
At the end of the experiment, the user must end the run:
yprov4ml.end_run(
create_graph: Optional[bool] = False,
create_svg: Optional[bool] = False,
crate_ro_crate: Optional[bool] = False,
create_card: Optional[bool] = False,
)
| Parameter | Type | Description |
|---|---|---|
create_graph | Optional[bool] | Optional. Whether to create the graph |
create_svg | Optional[bool] | Optional. Whether to create the svg |
crate_ro_crate | Optional[bool] | Optional. Indicates whether to pack the experiment in a ro-crate zip, containing all the run's information. |
create_card | Optional[bool] | Optional. Indicates whether to convert the created run directory to Workflow cards format. |
This call allows the library to save the provenance graph in the specified directory.
We allow to pack the entire experiment data as a RO-Crate to enable the user to easily share the final execution of his experiment.