예제 #1
0
    def test_creation_and_hydration(self):
        run_data, metrics, params = 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, tags,
         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,
                            "tags": tags,
                            "artifact_uri": artifact_uri,
                            },
                   "data": {"metrics": metrics,
                            "params": params}}
        self.assertEqual(dict(run1), 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)
예제 #2
0
파일: test_run.py 프로젝트: zxf1864/mlflow
    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, 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,
                "lifecycle_stage": lifecycle_stage,
                "artifact_uri": artifact_uri,
            },
            "data": {
                "metrics": [dict(m) for m in metrics],
                "params": [dict(p) for p in params],
                "tags": [dict(t) 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, run_data)

        run3 = Run.from_dictionary(as_dict)
        self._check_run(run3, run_info, run_data)