def test_build_config(test_output_dirs: OutputFolderForTests) -> None: """ Test that json with build information is created correctly. """ config = AzureConfig(build_number=42, build_user="******", build_branch="branch", build_source_id="00deadbeef", build_source_author="author", tag="tag", model="model") result_location = ExperimentResultLocation(azure_job_name="job") net_json = build_information_to_dot_net_json(config, result_location) expected = '{"BuildNumber": 42, "BuildRequestedFor": "user", "BuildSourceBranchName": "branch", ' \ '"BuildSourceVersion": "00deadbeef", "BuildSourceAuthor": "author", "ModelName": "model", ' \ '"ResultsContainerName": null, "ResultsUri": null, "DatasetFolder": null, "DatasetFolderUri": null, ' \ '"AzureBatchJobName": "job"}' assert expected == net_json result_folder = test_output_dirs.root_dir / "buildinfo" build_information_to_dot_net_json_file(config, result_location, folder=result_folder) result_file = result_folder / BUILDINFORMATION_JSON assert result_file.exists() assert result_file.read_text() == expected
def save_build_info_for_dotnet_consumers(self) -> None: results_container = get_results_blob_path(RUN_CONTEXT.id) result_location = ExperimentResultLocation( azure_job_name=RUN_CONTEXT.id, dataset_folder=self.model_config.azure_dataset_id, results_container_name=results_container, commandline_overrides=str(self.model_config.overrides), dataset_uri=self.model_config.azure_dataset_id, results_uri="", ) # Fill in the missing information in the build config (everything that is not available at the time # of evoking the runner), and then save in the format needed for the .NET consumers build_information_to_dot_net_json_file( self.azure_config, result_location, folder=self.model_config.outputs_folder)