def test_creation_and_hydration(self): run_data, metrics, params, tags = TestRunData._create() (run_info, run_uuid, experiment_id, name, source_type, source_name, entry_point_name, user_id, status, start_time, end_time, source_version, lifecycle_stage, artifact_uri) = TestRunInfo._create() run1 = Run(run_info, run_data) self._check_run(run1, run_info, metrics, params, tags) as_dict = {"info": {"run_uuid": run_uuid, "experiment_id": experiment_id, "name": name, "source_type": source_type, "source_name": source_name, "entry_point_name": entry_point_name, "user_id": user_id, "status": status, "start_time": start_time, "end_time": end_time, "source_version": source_version, "lifecycle_stage": lifecycle_stage, "artifact_uri": artifact_uri, }, "data": {"metrics": {m.key: m.value for m in metrics}, "params": {p.key: p.value for p in params}, "tags": {t.key: t.value for t in tags}} } self.assertEqual(run1.to_dictionary(), as_dict) proto = run1.to_proto() run2 = Run.from_proto(proto) self._check_run(run2, run_info, metrics, params, tags)
def test_creation_and_hydration(self): run_data, metrics, params, tags = TestRunData._create() ( run_info, run_id, experiment_id, user_id, status, start_time, end_time, lifecycle_stage, artifact_uri, ) = TestRunInfo._create() run1 = Run(run_info, run_data) self._check_run(run1, run_info, metrics, params, tags) expected_info_dict = { "run_uuid": run_id, "run_id": run_id, "experiment_id": experiment_id, "user_id": user_id, "status": status, "start_time": start_time, "end_time": end_time, "lifecycle_stage": lifecycle_stage, "artifact_uri": artifact_uri, } self.assertEqual( run1.to_dictionary(), { "info": expected_info_dict, "data": { "metrics": {m.key: m.value for m in metrics}, "params": {p.key: p.value for p in params}, "tags": {t.key: t.value for t in tags}, }, }, ) proto = run1.to_proto() run2 = Run.from_proto(proto) self._check_run(run2, run_info, metrics, params, tags) run3 = Run(run_info, None) self.assertEqual(run3.to_dictionary(), {"info": expected_info_dict})
def test_creation_and_hydration(self): run_data, metrics, params, tags = TestRunData._create() (run_info, run_uuid, experiment_id, name, source_type, source_name, entry_point_name, user_id, status, start_time, end_time, source_version, artifact_uri) = TestRunInfo._create() run1 = Run(run_info, run_data) self._check_run(run1, run_info, run_data) as_dict = { "info": { "run_uuid": run_uuid, "experiment_id": experiment_id, "name": name, "source_type": source_type, "source_name": source_name, "entry_point_name": entry_point_name, "user_id": user_id, "status": status, "start_time": start_time, "end_time": end_time, "source_version": source_version, "artifact_uri": artifact_uri, }, "data": { "metrics": metrics, "params": params, "tags": tags } } self.assertEqual(run1.to_dictionary(), as_dict) proto = run1.to_proto() run2 = Run.from_proto(proto) self._check_run(run2, run_info, run_data) run3 = Run.from_dictionary(as_dict) self._check_run(run3, run_info, run_data)