def test_creation_and_hydration(self): (ri1, run_uuid, experiment_id, name, source_type, source_name, entry_point_name, user_id, status, start_time, end_time, source_version, tags, artifact_uri) = self._create() self._check(ri1, run_uuid, experiment_id, name, source_type, source_name, entry_point_name, user_id, status, start_time, end_time, source_version, tags, artifact_uri) as_dict = { "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, "tags": tags, "artifact_uri": artifact_uri, } self.assertEqual(dict(ri1), as_dict) proto = ri1.to_proto() ri2 = RunInfo.from_proto(proto) self._check(ri2, run_uuid, experiment_id, name, source_type, source_name, entry_point_name, user_id, status, start_time, end_time, source_version, tags, artifact_uri) ri3 = RunInfo.from_dictionary(as_dict) self._check(ri3, run_uuid, experiment_id, name, source_type, source_name, entry_point_name, user_id, status, start_time, end_time, source_version, tags, artifact_uri)
def from_dictionary(cls, the_dict): if "info" not in the_dict or "data" not in the_dict: raise Exception( "Malformed input '%s'. Run cannot be constructed." % str(the_dict)) the_info = RunInfo.from_dictionary(the_dict.get("info")) the_data = RunData.from_dictionary(the_dict.get("data")) return cls(the_info, the_data)
def get_run_info(run_dir): meta = read_yaml(run_dir, FileStore.META_DATA_FILE_NAME) return RunInfo.from_dictionary(meta)