def test_save_file(value: Any, expected: Any) -> None: file = full_ml_test_data_path("test.txt") io_util.save_lines_to_file(Path(file), value) assert_file_contents(file, expected) os.remove(str(file))
def store_run_information(results_folder: Path, dataset_id: Optional[str], ground_truth_ids: List[str], image_channels: List[str]) -> None: """ Store dataset id and ground truth ids into files in the results folder. :param image_channels: The names of the image channels that the model consumes. :param results_folder: The folder where the files should be stored. :param dataset_id: The dataset id :param ground_truth_ids: The list of ground truth ids """ # Recovery runs will download the previous job's output folder, it could contain these files. # Save these files for each epoch to keep the folders self-contained # Save the dataset id to a file save_lines_to_file(results_folder / DATASET_ID_FILE, [dataset_id or ""]) # Save ground truth ids in a file save_lines_to_file(results_folder / GROUND_TRUTH_IDS_FILE, ground_truth_ids) # Save channel ids in a file save_lines_to_file(results_folder / IMAGE_CHANNEL_IDS_FILE, image_channels)