Exemple #1
0
 def registerJob(self, request, context):
     job = transform_job_meta(request.job)
     response = self.store.register_job(name=job.name, workflow_execution_id=job.workflow_execution_id,
                                        job_state=job.job_state, properties=job.properties, job_id=job.job_id,
                                        start_time=job.start_time, end_time=job.end_time, log_uri=job.log_uri,
                                        signature=job.signature)
     return _wrap_meta_response(MetaToProto.job_meta_to_proto(response))
Exemple #2
0
 def getModelById(self, request, context):
     model_relation = self.store.get_model_relation_by_id(request.id)
     if model_relation is None:
         model_detail = None
     else:
         model_detail = self.model_center_client.get_registered_model_detail(model_relation.name)
     return _wrap_meta_response(MetaToProto.model_meta_to_proto(model_relation, model_detail))
 def registerModel(self, request, context):
     model = transform_model_meta(request.model)
     model_detail = self.model_center_client.create_registered_model(
         model.name, ModelType.Name(model.model_type), model.model_desc)
     model_relation = self.store.register_model_relation(
         name=model.name, project_id=model.project_id)
     return _wrap_meta_response(
         MetaToProto.model_meta_to_proto(model_relation, model_detail))
Exemple #4
0
 def registerArtifact(self, request, context):
     artifact = transform_artifact_meta(request.artifact)
     response = self.store.register_artifact(name=artifact.name, data_format=artifact.data_format,
                                             description=artifact.description,
                                             batch_uri=artifact.batch_uri, stream_uri=artifact.stream_uri,
                                             create_time=artifact.create_time,
                                             update_time=artifact.update_time, properties=artifact.properties)
     return _wrap_meta_response(MetaToProto.artifact_meta_to_proto(response))
Exemple #5
0
 def getModelVersionByVersion(self, request, context):
     model_version_relation = self.store.get_model_version_relation_by_version(request.name, request.model_id)
     if model_version_relation is None:
         model_version_detail = None
     else:
         model_relation = self.store.get_model_relation_by_id(model_version_relation.model_id)
         model_version_detail = self.model_center_client.get_model_version_detail(model_relation.name, request.name)
     return _wrap_meta_response(
         MetaToProto.model_version_meta_to_proto(model_version_relation, model_version_detail))
 def registerModelVersionRelation(self, request, context):
     model_version = transform_model_version_relation_meta(
         request.model_version_relation)
     response = self.store.register_model_version_relation(
         version=model_version.version,
         model_id=model_version.model_id,
         workflow_execution_id=model_version.workflow_execution_id)
     return _wrap_meta_response(
         MetaToProto.model_version_relation_meta_to_proto(response))
 def registerProject(self, request, context):
     project = transform_project_meta(request.project)
     response = self.store.register_project(
         name=project.name,
         uri=project.uri,
         properties=project.properties,
         user=project.user,
         password=project.password,
         project_type=project.project_type)
     return _wrap_meta_response(MetaToProto.project_meta_to_proto(response))
Exemple #8
0
 def updateProject(self, request, context):
     properties = None if request.properties == {} else request.properties
     project = self.store.update_project(project_name=request.name,
                                         uri=request.uri.value if request.HasField('uri') else None,
                                         properties=properties,
                                         user=request.user.value if request.HasField('user') else None,
                                         password=request.password.value if request.HasField('password') else None,
                                         project_type=request.project_type.value if request.HasField(
                                             'project_type') else None
                                         )
     return _wrap_meta_response(MetaToProto.project_meta_to_proto(project))
Exemple #9
0
 def getLatestGeneratedModelVersion(self, request, context):
     model_version_detail = self.store.get_latest_generated_model_version(request.name)
     if model_version_detail is None:
         model_version_relation = None
     else:
         model_relation = self.store.get_model_relation_by_name(request.name)
         model_version_relation = self.store.get_model_version_relation_by_version(
             model_version_detail.model_version,
             model_relation.uuid)
     return _wrap_meta_response(
         MetaToProto.model_version_store_to_proto(model_version_relation, model_version_detail))
Exemple #10
0
 def registerExampleWithCatalog(self, request, context):
     example = transform_example_meta(request.example)
     example_meta = self.store.register_example_with_catalog(name=example.name,
                                                             support_type=example.support_type,
                                                             catalog_name=example.catalog_name,
                                                             catalog_type=example.catalog_type,
                                                             catalog_database=example.catalog_database,
                                                             catalog_connection_uri=example.catalog_connection_uri,
                                                             catalog_version=example.catalog_version,
                                                             catalog_table=example.catalog_table)
     return _wrap_meta_response(MetaToProto.example_meta_to_proto(example_meta))
Exemple #11
0
 def updateJob(self, request, context):
     properties = None if request.properties == {} else request.properties
     job_state = None if request.job_state == 0 else State(StateProto.Name(request.job_state))
     job = self.store.update_job(job_name=request.name, job_state=job_state,
                                 properties=properties,
                                 job_id=request.job_id.value if request.HasField('job_id') else None,
                                 workflow_execution_id=request.workflow_execution_id.value
                                 if request.HasField('workflow_execution_id') else None,
                                 end_time=request.end_time.value if request.HasField('end_time') else None,
                                 log_uri=request.log_uri.value if request.HasField('log_uri') else None,
                                 signature=request.signature.value if request.HasField('signature') else None)
     return _wrap_meta_response(MetaToProto.job_meta_to_proto(job))
Exemple #12
0
 def registerWorkFlowExecution(self, request, context):
     workflow_execution = transform_workflow_execution_meta(request.workflow_execution)
     response = self.store.register_workflow_execution(name=workflow_execution.name,
                                                       project_id=workflow_execution.project_id,
                                                       execution_state=workflow_execution.execution_state,
                                                       properties=workflow_execution.properties,
                                                       start_time=workflow_execution.start_time,
                                                       end_time=workflow_execution.end_time,
                                                       log_uri=workflow_execution.log_uri,
                                                       workflow_json=workflow_execution.workflow_json,
                                                       signature=workflow_execution.signature
                                                       )
     return _wrap_meta_response(MetaToProto.workflow_execution_meta_to_proto(response))
Exemple #13
0
 def registerExample(self, request, context):
     example = transform_example_meta(request.example)
     example_meta = self.store.register_example(name=example.name,
                                                support_type=example.support_type,
                                                data_type=example.data_type,
                                                data_format=example.data_format,
                                                description=example.description,
                                                batch_uri=example.batch_uri,
                                                stream_uri=example.stream_uri,
                                                create_time=example.create_time,
                                                update_time=example.update_time,
                                                properties=example.properties,
                                                name_list=example.schema.name_list,
                                                type_list=example.schema.type_list)
     return _wrap_meta_response(MetaToProto.example_meta_to_proto(example_meta))
Exemple #14
0
 def registerModelVersion(self, request, context):
     model_version = transform_model_version_meta(request.model_version)
     model_relation = self.store.get_model_relation_by_id(model_version.model_id)
     model_version_detail = self.model_center_client.create_model_version(model_relation.name,
                                                                          model_version.model_path,
                                                                          model_version.model_metric,
                                                                          model_version.model_flavor,
                                                                          model_version.version_desc,
                                                                          request.model_version.current_stage)
     model_version_relation = self.store.register_model_version_relation(version=model_version_detail.model_version,
                                                                         model_id=model_version.model_id,
                                                                         workflow_execution_id=
                                                                         model_version.workflow_execution_id)
     return _wrap_meta_response(
         MetaToProto.model_version_meta_to_proto(model_version_relation, model_version_detail))
Exemple #15
0
 def updateArtifact(self, request, context):
     properties = None if request.properties == {} else request.properties
     artifact = self.store.update_artifact(artifact_name=request.name,
                                           data_format=request.data_format.value if request.HasField(
                                               'data_format') else None,
                                           properties=properties,
                                           description=request.description.value if request.HasField(
                                               'description') else None,
                                           batch_uri=request.batch_uri.value if request.HasField(
                                               'batch_uri') else None,
                                           stream_uri=request.stream_uri.value if request.HasField(
                                               'stream_uri') else None,
                                           update_time=request.update_time.value if request.HasField(
                                               'update_time') else None
                                           )
     return _wrap_meta_response(MetaToProto.artifact_meta_to_proto(artifact))
Exemple #16
0
 def updateWorkflowExecution(self, request, context):
     properties = None if request.properties == {} else request.properties
     execution_state = None if request.execution_state == 0 else State(StateProto.Name(request.execution_state))
     workflow_execution = self.store.update_workflow_execution(execution_name=request.name,
                                                               execution_state=execution_state,
                                                               project_id=request.project_id.value if request.HasField(
                                                                   'project_id') else None,
                                                               properties=properties,
                                                               end_time=request.end_time.value if request.HasField(
                                                                   'end_time') else None,
                                                               log_uri=request.log_uri_value if request.HasField(
                                                                   'log_uri') else None,
                                                               workflow_json=request.workjson.value if request.HasField(
                                                                   'workflow_json') else None,
                                                               signature=request.signature.value if request.HasField(
                                                                   'signature') else None)
     return _wrap_meta_response(MetaToProto.workflow_execution_meta_to_proto(workflow_execution))
 def updateExample(self, request, context):
     support_type = None if request.support_type == 0 else ExampleSupportType(
         ExampleSupportTypeProto.Name(request.support_type))
     properties = None if request.properties == {} else request.properties
     name_list = request.name_list
     type_list = request.type_list
     if not name_list:
         name_list = None
     if not type_list:
         data_type_list = None
     else:
         data_type_list = []
         for data_type in type_list:
             data_type_list.append(DataType(DataTypeProto.Name(data_type)))
     example_meta = self.store.update_example(example_name=request.name,
                                              support_type=support_type,
                                              data_type=request.data_type.value if request.HasField(
                                                  'data_type') else None,
                                              data_format=request.data_format.value if request.HasField(
                                                  'data_format') else None,
                                              description=request.description.value if request.HasField(
                                                  'description') else None,
                                              batch_uri=request.batch_uri.value if request.HasField(
                                                  'batch_uri') else None,
                                              stream_uri=request.stream_uri.value if request.HasField(
                                                  'stream_uri') else None,
                                              update_time=request.update_time.value if request.HasField(
                                                  'update_time') else None,
                                              properties=properties,
                                              name_list=name_list,
                                              type_list=data_type_list,
                                              catalog_name=request.catalog_name.value if request.HasField(
                                                  'catalog_name') else None,
                                              catalog_type=request.catalog_type.value if request.HasField(
                                                  'catalog_type') else None,
                                              catalog_database=request.catalog_database.value if request.HasField(
                                                  'catalog_database') else None,
                                              catalog_version=request.catalog_version.value if request.HasField(
                                                  'catalog_version') else None,
                                              catalog_connection_uri=request.catalog_connection_uri.value \
                                                  if request.HasField('catalog_connection_uri') else None,
                                              catalog_table=request.catalog_table.value if request.HasField(
                                                  'catalog_table') else None)
     return _wrap_meta_response(
         MetaToProto.example_meta_to_proto(example_meta))
Exemple #18
0
 def getModelRelationByName(self, request, context):
     model_meta = self.store.get_model_relation_by_name(request.name)
     return _wrap_meta_response(MetaToProto.model_relation_meta_to_proto(model_meta))
Exemple #19
0
 def getArtifactByName(self, request, context):
     artifact_meta = self.store.get_artifact_by_name(request.name)
     return _wrap_meta_response(MetaToProto.artifact_meta_to_proto(artifact_meta))
Exemple #20
0
 def getExampleByName(self, request, context):
     example = self.store.get_example_by_name(request.name)
     return _wrap_meta_response(MetaToProto.example_meta_to_proto(example))
Exemple #21
0
 def registerModelRelation(self, request, context):
     model = transform_model_relation_meta(request.model_relation)
     response = self.store.register_model_relation(name=model.name, project_id=model.project_id)
     return _wrap_meta_response(MetaToProto.model_relation_meta_to_proto(response))
Exemple #22
0
 def getProjectByName(self, request, context):
     project_meta = self.store.get_project_by_name(request.name)
     return _wrap_meta_response(MetaToProto.project_meta_to_proto(project_meta))
Exemple #23
0
 def getWorkFlowExecutionByName(self, request, context):
     execution_meta = self.store.get_workflow_execution_by_name(request.name)
     return _wrap_meta_response(MetaToProto.workflow_execution_meta_to_proto(execution_meta))
Exemple #24
0
 def getModelByName(self, request, context):
     model_relation = self.store.get_model_relation_by_name(request.name)
     model_detail = self.model_center_client.get_registered_model_detail(request.name)
     return _wrap_meta_response(MetaToProto.model_meta_to_proto(model_relation, model_detail))
Exemple #25
0
 def getModelVersionRelationByVersion(self, request, context):
     model_version_meta = self.store.get_model_version_relation_by_version(request.name, request.model_id)
     return _wrap_meta_response(MetaToProto.model_version_relation_meta_to_proto(model_version_meta))
Exemple #26
0
 def getJobByName(self, request, context):
     job_meta = self.store.get_job_by_name(request.name)
     return _wrap_meta_response(MetaToProto.job_meta_to_proto(job_meta))