[
https://issues.apache.org/jira/browse/BEAM-13633?focusedWorklogId=714318&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-714318
]
ASF GitHub Bot logged work on BEAM-13633:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 25/Jan/22 09:31
Start Date: 25/Jan/22 09:31
Worklog Time Spent: 10m
Work Description: daria-malkova commented on a change in pull request
#16484:
URL: https://github.com/apache/beam/pull/16484#discussion_r791512285
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -294,3 +293,35 @@ 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())
+ }
+ catalog, err := controller.cacheService.GetCatalog(ctx)
+ if err != nil {
+ logger.Errorf("GetDefaultPrecompiledObject(): cache error: %s",
err.Error())
+ catalog, err = utils.GetCatalogFromStorage(ctx)
+ if err != nil {
+ return nil, errors.InternalError("Error during getting
Precompiled Objects", "Error with cloud connection")
+ }
+ if err = controller.cacheService.SetCatalog(ctx, catalog); err
!= nil {
+ logger.Errorf("GetDefaultPrecompiledObject(): cache
error: %s", err.Error())
+ }
+ }
Review comment:
Code duplication with lines 245-255
##########
File path: playground/backend/cmd/server/server.go
##########
@@ -109,6 +118,18 @@ func setupCache(ctx context.Context, appEnv
environment.ApplicationEnvs) (cache.
}
}
+// setupExamplesCatalog saves precompiled objects catalog from storage to cache
+func setupExamplesCatalog(ctx context.Context, cacheService cache.Cache) error
{
Review comment:
No tests for this method added
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -34,7 +36,75 @@ func PutPrecompiledObjectsToCategory(categoryName string,
precompiledObjects *cl
Type: object.Type,
PipelineOptions: object.PipelineOptions,
Link: object.Link,
+ DefaultExample: object.DefaultExample,
})
}
sdkCategory.Categories = append(sdkCategory.Categories, &category)
}
+
+// GetCatalogFromStorage returns the precompiled objects catalog from the
cloud storage
+func GetCatalogFromStorage(ctx context.Context) ([]*pb.Categories, error) {
Review comment:
No tests
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 714318)
Time Spent: 4h (was: 3h 50m)
> Implement method to get a default example for each SDKs
> -------------------------------------------------------
>
> Key: BEAM-13633
> URL: https://issues.apache.org/jira/browse/BEAM-13633
> Project: Beam
> Issue Type: Sub-task
> Components: beam-playground
> Reporter: Pavel Avilov
> Assignee: Pavel Avilov
> Priority: P2
> Labels: beam-playground-backend, beam-playground-sprint-7
> Time Spent: 4h
> Remaining Estimate: 0h
>
> Need to implement a method that will return a default example for each SDKs.
> Store the description of default examples in the config.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)