예제 #1
0
 def UpdateWorkflow(self, request, context):
     try:
         return self._server.update_workflow(request, context)
     except UnauthorizedException as e:
         return service_pb2.UpdateWorkflowResponse(status=common_pb2.Status(
             code=common_pb2.STATUS_UNAUTHORIZED, msg=repr(e)))
     except Exception as e:
         logging.error('UpdateWorkflow rpc server error: %s', repr(e))
         return service_pb2.UpdateWorkflowResponse(status=common_pb2.Status(
             code=common_pb2.STATUS_UNKNOWN_ERROR, msg=repr(e)))
예제 #2
0
파일: server.py 프로젝트: guotie/fedlearner
    def update_workflow(self, request, context):
        with self._app.app_context():
            project, party = self.check_auth_info(request.auth_info, context)
            workflow = Workflow.query.filter_by(
                name=request.workflow_name,
                project_id=project.id).first()
            assert workflow is not None, "Workflow not found"
            config = workflow.get_config()
            _merge_workflow_config(
                config, request.config,
                [common_pb2.Variable.PEER_WRITABLE])
            workflow.set_config(config)
            db.session.commit()

            self._filter_workflow(
                config,
                [
                    common_pb2.Variable.PEER_READABLE,
                    common_pb2.Variable.PEER_WRITABLE
                ])
            return service_pb2.UpdateWorkflowResponse(
                status=common_pb2.Status(
                    code=common_pb2.STATUS_SUCCESS),
                workflow_name=request.workflow_name,
                config=config)
예제 #3
0
 def update_workflow(self, name, config):
     msg = service_pb2.UpdateWorkflowRequest(
         auth_info=self._auth_info,
         workflow_name=name,
         config=config)
     try:
         response = self._client.UpdateWorkflow(
             request=msg, metadata=self._get_metadata())
         if response.status.code != common_pb2.STATUS_SUCCESS:
             logging.error(
                 'update_workflow request error: %s',
                 response.status.msg)
         return response
     except Exception as e:
         logging.error('update_workflow request error: %s', repr(e))
         return service_pb2.UpdateWorkflowResponse(
             status=common_pb2.Status(
                 code=common_pb2.STATUS_UNKNOWN_ERROR,
                 msg=repr(e)))