Transport-for-the-North / caf.toolkit

Toolkit of transport planning and appraisal functionalities.
https://caftoolkit.readthedocs.io/en/stable/
Other
0 stars 2 forks source link

Tool Run Config Cache Writer #130

Closed MattBuckley-TfN closed 3 months ago

MattBuckley-TfN commented 4 months ago

Function for writing all the parameters and metadata from a tool / model run to a YAML file and storing it in a run log cache folder. This would require two functions, one to write the YAML file and one to handle where the run cache should be written to.

This could be handled with a class to manage the full run log YAML file, a function to produce and write the file and another function to handle where it should be written to.

class _RunLog(BaseConfig):
    configs: dict[str, BaseConfig]
    tool_details: ToolDetails
    system_information: SystemInformation

def write_run_log(path: pathlib.Path, tool_details: ToolDetails, *configs: BaseConfig) -> None:
    run_log  = _RunLog(*configs, tool_details=tool_details, system_information=SystemInformation.load())
    run_log.save_yaml(path)

def write_run_log_to_cache():
    ...
MattBuckley-TfN commented 3 months ago

124 has a suggestion for implementing a write_metadata function which could provide all the functionality suggested in this issue in a much simpler way.

MattBuckley-TfN commented 3 months ago

Covered in #124