コード例 #1
0
ファイル: test_run_info.py プロジェクト: 15021687693/lbg
    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)
コード例 #2
0
 def from_proto(cls, proto):
     return cls(RunInfo.from_proto(proto.info), RunData.from_proto(proto.data))
コード例 #3
0
 def update_run_info(self, run_uuid, run_status, end_time):
     """ Updates the metadata of the specified run. """
     req_body = _message_to_json(
         UpdateRun(run_uuid=run_uuid, status=run_status, end_time=end_time))
     response_proto = self._call_endpoint(UpdateRun, req_body)
     return RunInfo.from_proto(response_proto.run_info)