pavel-avilov commented on a change in pull request #16484:
URL: https://github.com/apache/beam/pull/16484#discussion_r784926745



##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -294,3 +294,28 @@ func (controller *playgroundController) 
GetPrecompiledObjectLogs(ctx context.Con
        response := pb.GetPrecompiledObjectLogsResponse{Output: logs}
        return &response, nil
 }
+
+// GetDefaultPrecompiledObject returns the default precompile object for sdk.
+func (controller *playgroundController) GetDefaultPrecompiledObject(ctx 
context.Context, info *pb.GetDefaultPrecompiledObjectRequest) 
(*pb.GetDefaultPrecompiledObjectResponse, error) {
+       switch info.Sdk {
+       case pb.Sdk_SDK_UNSPECIFIED, pb.Sdk_SDK_SCIO:
+               logger.Errorf("GetDefaultPrecompiledObject(): unimplemented 
sdk: %s\n", info.Sdk)
+               return nil, errors.InvalidArgumentError("Error during 
preparing", "Sdk is not implemented yet: %s", info.Sdk.String())
+       }
+
+       bucket := cloud_bucket.New()
+       precompiledObject, err := bucket.GetDefaultPrecompileObject(ctx, 
info.Sdk, controller.env.ApplicationEnvs.WorkingDir())
+       if err != nil {
+               logger.Errorf("GetDefaultPrecompileObject(): cloud storage 
error: %s", err.Error())
+               return nil, errors.InternalError("Error during getting default 
Precompiled Object", "Error with cloud connection")
+       }
+
+       response := pb.GetDefaultPrecompiledObjectResponse{PrecompiledObject: 
&pb.PrecompiledObject{
+               CloudPath:       precompiledObject.CloudPath,
+               Name:            precompiledObject.Name,
+               Description:     precompiledObject.Description,
+               Type:            precompiledObject.Type,
+               PipelineOptions: precompiledObject.PipelineOptions,
+       }}

Review comment:
       Yes, this information will be enough for frontend.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to