You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/01/12 14:44:09 UTC
[GitHub] [beam] KhaninArtur opened a new pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
KhaninArtur opened a new pull request #16493:
URL: https://github.com/apache/beam/pull/16493
[BEAM-13632](https://issues.apache.org/jira/browse/BEAM-13632) The catalog is now saved into the cache at the server startup.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [x] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
- [x] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
`ValidatesRunner` compliance status (on master branch)
--------------------------------------------------------
<table>
<thead>
<tr>
<th>Lang</th>
<th>ULR</th>
<th>Dataflow</th>
<th>Flink</th>
<th>Samza</th>
<th>Spark</th>
<th>Twister2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Go</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon">
</a>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Samza/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Samza/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
</tr>
<tr>
<td>Java</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_ULR/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_ULR/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon?subject=V1">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Streaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Streaming/lastCompletedBuild/badge/icon?subject=V1+Streaming">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon?subject=V1+Java+11">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2/lastCompletedBuild/badge/icon?subject=V2">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2_Streaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_VR_Dataflow_V2_Streaming/lastCompletedBuild/badge/icon?subject=V2+Streaming">
</a><br>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon?subject=Java+8">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/badge/icon?subject=Java+11">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon?subject=Portable">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon?subject=Portable+Streaming">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Samza/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Samza/lastCompletedBuild/badge/icon?subject=Portable">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon?subject=Portable">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon?subject=Structured+Streaming">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Twister2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Twister2/lastCompletedBuild/badge/icon">
</a>
</td>
</tr>
<tr>
<td>Python</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/badge/icon?subject=V1">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Py_VR_Dataflow_V2/lastCompletedBuild/badge/icon?subject=V2">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/badge/icon?subject=ValCont">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/badge/icon?subject=Portable">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Flink/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Samza/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Samza/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python_VR_Spark/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
</tr>
<tr>
<td>XLang</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Direct/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Direct/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Dataflow/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Dataflow/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Flink/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Samza/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Samza/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_XVR_Spark/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
</tr>
</tbody>
</table>
Examples testing status on various runners
--------------------------------------------------------
<table>
<thead>
<tr>
<th>Lang</th>
<th>ULR</th>
<th>Dataflow</th>
<th>Flink</th>
<th>Samza</th>
<th>Spark</th>
<th>Twister2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Go</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
<tr>
<td>Java</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Cron/lastCompletedBuild/badge/icon?subject=V1">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Java11_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Java_Examples_Dataflow_Java11_Cron/lastCompletedBuild/badge/icon?subject=V1+Java11">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java_Examples_Dataflow_V2/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java_Examples_Dataflow_V2/lastCompletedBuild/badge/icon?subject=V2">
</a><br>
</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
<tr>
<td>Python</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
<tr>
<td>XLang</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
</tbody>
</table>
Post-Commit SDK/Transform Integration Tests Status (on master branch)
------------------------------------------------------------------------------------------------
<table>
<thead>
<tr>
<th>Go</th>
<th>Java</th>
<th>Python</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python36/lastCompletedBuild/badge/icon?subject=3.6">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python37/lastCompletedBuild/badge/icon?subject=3.7">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PostCommit_Python38/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PostCommit_Python38/lastCompletedBuild/badge/icon?subject=3.8">
</a>
</td>
</tr>
</tbody>
</table>
Pre-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
<table>
<thead>
<tr>
<th>---</th>
<th>Java</th>
<th>Python</th>
<th>Go</th>
<th>Website</th>
<th>Whitespace</th>
<th>Typescript</th>
</tr>
</thead>
<tbody>
<tr>
<td>Non-portable</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Java_Cron/lastCompletedBuild/badge/icon">
</a><br>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/lastCompletedBuild/badge/icon?subject=Tests">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/lastCompletedBuild/badge/icon?subject=Lint">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/badge/icon?subject=Docker">
</a><br>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/badge/icon?subject=Docs">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Go_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Website_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Whitespace_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Typescript_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Typescript_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
</tr>
<tr>
<td>Portable</td>
<td>---</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>
<a href="https://ci-beam.apache.org/job/beam_PreCommit_GoPortable_Cron/lastCompletedBuild/">
<img alt="Build Status" src="https://ci-beam.apache.org/job/beam_PreCommit_GoPortable_Cron/lastCompletedBuild/badge/icon">
</a>
</td>
<td>---</td>
<td>---</td>
<td>---</td>
</tr>
</tbody>
</table>
See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r784563458
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,28 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx context.Context, info *pb.GetPrecompiledObjectsRequest) (*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, info.Category)
+ if info.Sdk == pb.Sdk_SDK_UNSPECIFIED && info.Category == "" {
+ catalog, err := utils.GetPrecompiledObjectsCatalogFromCache(ctx, controller.cacheService)
+ if err == nil {
+ return &pb.GetPrecompiledObjectsResponse{SdkCategories: catalog}, nil
+ } else {
+ logger.Errorf("GetPrecompiledObjects(): cache error: %s", err.Error())
+ }
Review comment:
Good idea, thanks!
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] pabloem merged pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
pabloem merged pull request #16493:
URL: https://github.com/apache/beam/pull/16493
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r784052287
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,20 +241,34 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx context.Context, info *pb.GetPrecompiledObjectsRequest) (*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, info.Category)
- if err != nil {
- logger.Errorf("GetPrecompiledObjects(): cloud storage error: %s", err.Error())
- return nil, errors.InternalError("Error during getting Precompiled Objects", "Error with cloud connection")
- }
- response := pb.GetPrecompiledObjectsResponse{SdkCategories: make([]*pb.Categories, 0)}
- for sdkName, categories := range *sdkToCategories {
- sdkCategory := pb.Categories{Sdk: pb.Sdk(pb.Sdk_value[sdkName]), Categories: make([]*pb.Categories_Category, 0)}
- for categoryName, precompiledObjects := range categories {
- utils.PutPrecompiledObjectsToCategory(categoryName, &precompiledObjects, &sdkCategory)
+ var response pb.GetPrecompiledObjectsResponse
+ if info.Sdk != pb.Sdk_SDK_UNSPECIFIED || info.Category != "" {
+ sdkCategories, err := utils.GetPrecompiledObjectsCatalogFromStorage(ctx, info.Sdk, info.Category)
+ if err != nil {
+ logger.Errorf("GetPrecompiledObjects(): cloud storage error: %s", err.Error())
+ return nil, errors.InternalError("Error during getting Precompiled Objects", "Error with cloud connection")
+ }
+ response = pb.GetPrecompiledObjectsResponse{SdkCategories: sdkCategories}
Review comment:
Good idea, done.
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -37,3 +46,37 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
sdkCategory.Categories = append(sdkCategory.Categories, &category)
}
+
+// GetPrecompiledObjectsCatalogFromCache returns the precompiled objects catalog from the cache
+func GetPrecompiledObjectsCatalogFromCache(ctx context.Context, cacheService cache.Cache) ([]*pb.Categories, error) {
+ value, err := cacheService.GetValue(ctx, ExamplesDataPipelineId, cache.ExamplesCatalog)
+ if err != nil {
+ logger.Errorf("%s: cache.GetValue: %s\n", ExamplesDataPipelineId, err.Error())
+ return nil, err
+ }
+ catalog, converted := value.([]*pb.Categories)
+ if !converted {
+ logger.Errorf("%s: couldn't convert value to catalog: %s", cache.ExamplesCatalog, value)
+ return nil, errors.InternalError("Error during getting the catalog from cache", "Error during getting status")
Review comment:
Done
##########
File path: playground/backend/internal/utils/precompiled_objects_utils_test.go
##########
@@ -73,3 +77,82 @@ func TestPutPrecompiledObjectsToCategory(t *testing.T) {
})
}
}
+
+func TestGetPrecompiledObjectsCatalogFromCache(t *testing.T) {
+ ctx := context.Background()
+ sdkCategories := []*pb.Categories{
+ {
+ Sdk: pb.Sdk_SDK_JAVA,
+ Categories: []*pb.Categories_Category{
+ {
+ CategoryName: "TestCategory", PrecompiledObjects: []*pb.PrecompiledObject{
+ {
+ CloudPath: "SDK_JAVA/TestCategory/TestName.java",
+ Name: "TestName",
+ Description: "TestDescription",
+ Type: pb.PrecompiledObjectType_PRECOMPILED_OBJECT_TYPE_EXAMPLE,
+ },
+ },
+ },
+ },
+ }}
+ type args struct {
+ ctx context.Context
+ cacheService cache.Cache
+ }
+ tests := []struct {
+ name string
+ args args
+ prepFunc func(cacheService cache.Cache) error
+ want []*pb.Categories
+ wantErr bool
+ }{
+ {
+ // Test case with getting Precompiled Objects Catalog from cache when it exists.
+ // As a result, want to receive an expected catalog from cache.
+ name: "get existing catalog",
+ args: args{
+ ctx: ctx,
+ cacheService: local.New(ctx),
+ },
+ prepFunc: func(cacheService cache.Cache) error {
+ err := cacheService.SetValue(ctx, uuid.Nil, cache.ExamplesCatalog, sdkCategories)
+ if err != nil {
+ return err
+ }
+ return nil
+ },
+ want: sdkCategories,
+ wantErr: false,
+ },
+ // Test case with getting Precompiled Objects Catalog from cache when it doesn't exist.
+ // As a result, want to receive an error.
+ {
+ name: "get missing catalog",
Review comment:
Done
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r783984978
##########
File path: playground/backend/cmd/server/server.go
##########
@@ -109,6 +119,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 {
+ sdkCategories, err := utils.GetPrecompiledObjectsCatalogFromStorage(ctx, pb.Sdk_SDK_UNSPECIFIED, "")
+ if err != nil {
+ return err
Review comment:
There is no need because there will be a panic in the server and we will see the error in logs.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] pabloem commented on pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
pabloem commented on pull request #16493:
URL: https://github.com/apache/beam/pull/16493#issuecomment-1026079250
this looks fine to me. thanks!
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r790939943
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,24 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
Review comment:
Thanks for noticing, changed!
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] AydarZaynutdinov commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
AydarZaynutdinov commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r790867248
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,24 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
Review comment:
It seems that the comment here doesn't match the method logic. The method gets a catalog from the cache in all cases, not only if `SDK and category are unspecified`
##########
File path: playground/backend/internal/cache/cache.go
##########
@@ -75,4 +79,10 @@ type Cache interface {
// SetExpTime adds expiration time of the pipeline to cache by pipelineId.
SetExpTime(ctx context.Context, pipelineId uuid.UUID, expTime time.Duration) error
+
+ // SetCatalog adds the given catalog to cache by ExamplesCatalog key.
+ SetCatalog(ctx context.Context, catalog []*pb.Categories) error
+
+ // GetCatalog return catalog from cache by ExamplesCatalog key.
+ GetCatalog(ctx context.Context) ([]*pb.Categories, error)
Review comment:
Why can't we use already existing methods `GetValue` and `SetValue`? Is it because we use `Get`/`Set` for catalog instead of `HGet`/`HSet`?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r792457161
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -37,3 +46,37 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
sdkCategory.Categories = append(sdkCategory.Categories, &category)
}
+
+// GetPrecompiledObjectsCatalogFromCache returns the precompiled objects catalog from the cache
+func GetPrecompiledObjectsCatalogFromCache(ctx context.Context, cacheService cache.Cache) ([]*pb.Categories, error) {
Review comment:
This one became redundant and `GetPrecompiledObjectsCatalogFromStorage` I changed to `GetCatalogFromStorage`
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on pull request #16493:
URL: https://github.com/apache/beam/pull/16493#issuecomment-1011122818
R: @ilya-kozyrev
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ilya-kozyrev commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
ilya-kozyrev commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r786793309
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,27 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx context.Context, info *pb.GetPrecompiledObjectsRequest) (*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, info.Category)
+ if info.Sdk == pb.Sdk_SDK_UNSPECIFIED && info.Category == "" {
Review comment:
why we need this if here?
##########
File path: playground/backend/internal/cache/cache.go
##########
@@ -55,6 +55,9 @@ const (
// LogsIndex is the index of the start of the log
LogsIndex SubKey = "LOGS_INDEX"
+
+ // ExamplesCatalog is catalog of examples available in Playground
+ ExamplesCatalog SubKey = "EXAMPLES_CATALOG"
Review comment:
Instead, make workarounds with subkey without pipeline id. Can we extend the Cache interface and implementation with SetCatalog, GetKatalog?
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -37,3 +46,37 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
sdkCategory.Categories = append(sdkCategory.Categories, &category)
}
+
+// GetPrecompiledObjectsCatalogFromCache returns the precompiled objects catalog from the cache
+func GetPrecompiledObjectsCatalogFromCache(ctx context.Context, cacheService cache.Cache) ([]*pb.Categories, error) {
Review comment:
can we make this name shorter?
GetPrecompiledObjectsFromCache
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] AydarZaynutdinov commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
AydarZaynutdinov commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r783162649
##########
File path: playground/backend/cmd/server/server.go
##########
@@ -109,6 +119,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 {
+ sdkCategories, err := utils.GetPrecompiledObjectsCatalogFromStorage(ctx, pb.Sdk_SDK_UNSPECIFIED, "")
+ if err != nil {
+ return err
Review comment:
Maybe add a log here?
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,20 +241,34 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx context.Context, info *pb.GetPrecompiledObjectsRequest) (*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, info.Category)
- if err != nil {
- logger.Errorf("GetPrecompiledObjects(): cloud storage error: %s", err.Error())
- return nil, errors.InternalError("Error during getting Precompiled Objects", "Error with cloud connection")
- }
- response := pb.GetPrecompiledObjectsResponse{SdkCategories: make([]*pb.Categories, 0)}
- for sdkName, categories := range *sdkToCategories {
- sdkCategory := pb.Categories{Sdk: pb.Sdk(pb.Sdk_value[sdkName]), Categories: make([]*pb.Categories_Category, 0)}
- for categoryName, precompiledObjects := range categories {
- utils.PutPrecompiledObjectsToCategory(categoryName, &precompiledObjects, &sdkCategory)
+ var response pb.GetPrecompiledObjectsResponse
+ if info.Sdk != pb.Sdk_SDK_UNSPECIFIED || info.Category != "" {
+ sdkCategories, err := utils.GetPrecompiledObjectsCatalogFromStorage(ctx, info.Sdk, info.Category)
+ if err != nil {
+ logger.Errorf("GetPrecompiledObjects(): cloud storage error: %s", err.Error())
+ return nil, errors.InternalError("Error during getting Precompiled Objects", "Error with cloud connection")
+ }
+ response = pb.GetPrecompiledObjectsResponse{SdkCategories: sdkCategories}
Review comment:
Maybe wrap this part as a separate method? So we could use this method in `else` part.
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -37,3 +46,37 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
sdkCategory.Categories = append(sdkCategory.Categories, &category)
}
+
+// GetPrecompiledObjectsCatalogFromCache returns the precompiled objects catalog from the cache
+func GetPrecompiledObjectsCatalogFromCache(ctx context.Context, cacheService cache.Cache) ([]*pb.Categories, error) {
+ value, err := cacheService.GetValue(ctx, ExamplesDataPipelineId, cache.ExamplesCatalog)
+ if err != nil {
+ logger.Errorf("%s: cache.GetValue: %s\n", ExamplesDataPipelineId, err.Error())
+ return nil, err
+ }
+ catalog, converted := value.([]*pb.Categories)
+ if !converted {
+ logger.Errorf("%s: couldn't convert value to catalog: %s", cache.ExamplesCatalog, value)
+ return nil, errors.InternalError("Error during getting the catalog from cache", "Error during getting status")
Review comment:
```suggestion
return nil, errors.InternalError("Error during getting the catalog from cache", "Error during getting catalog values")
```
##########
File path: playground/backend/internal/utils/precompiled_objects_utils_test.go
##########
@@ -73,3 +77,82 @@ func TestPutPrecompiledObjectsToCategory(t *testing.T) {
})
}
}
+
+func TestGetPrecompiledObjectsCatalogFromCache(t *testing.T) {
+ ctx := context.Background()
+ sdkCategories := []*pb.Categories{
+ {
+ Sdk: pb.Sdk_SDK_JAVA,
+ Categories: []*pb.Categories_Category{
+ {
+ CategoryName: "TestCategory", PrecompiledObjects: []*pb.PrecompiledObject{
+ {
+ CloudPath: "SDK_JAVA/TestCategory/TestName.java",
+ Name: "TestName",
+ Description: "TestDescription",
+ Type: pb.PrecompiledObjectType_PRECOMPILED_OBJECT_TYPE_EXAMPLE,
+ },
+ },
+ },
+ },
+ }}
+ type args struct {
+ ctx context.Context
+ cacheService cache.Cache
+ }
+ tests := []struct {
+ name string
+ args args
+ prepFunc func(cacheService cache.Cache) error
+ want []*pb.Categories
+ wantErr bool
+ }{
+ {
+ // Test case with getting Precompiled Objects Catalog from cache when it exists.
+ // As a result, want to receive an expected catalog from cache.
+ name: "get existing catalog",
+ args: args{
+ ctx: ctx,
+ cacheService: local.New(ctx),
+ },
+ prepFunc: func(cacheService cache.Cache) error {
+ err := cacheService.SetValue(ctx, uuid.Nil, cache.ExamplesCatalog, sdkCategories)
+ if err != nil {
+ return err
+ }
+ return nil
+ },
+ want: sdkCategories,
+ wantErr: false,
+ },
+ // Test case with getting Precompiled Objects Catalog from cache when it doesn't exist.
+ // As a result, want to receive an error.
+ {
+ name: "get missing catalog",
Review comment:
```suggestion
{
// Test case with getting Precompiled Objects Catalog from cache when it doesn't exist.
// As a result, want to receive an error.
name: "get missing catalog",
```
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] daria-malkova commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
daria-malkova commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r791530274
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -38,3 +40,54 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
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:
Is it possible to add tests for this method?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r792457299
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,27 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx context.Context, info *pb.GetPrecompiledObjectsRequest) (*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, info.Category)
+ if info.Sdk == pb.Sdk_SDK_UNSPECIFIED && info.Category == "" {
Review comment:
Changed per our discussion
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] daria-malkova commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
daria-malkova commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r791530274
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -38,3 +40,54 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
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:
Is it possible to add tests for this method?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on pull request #16493:
URL: https://github.com/apache/beam/pull/16493#issuecomment-1022118726
R: @pabloem
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ilya-kozyrev commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
ilya-kozyrev commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r786797822
##########
File path: playground/backend/internal/cache/cache.go
##########
@@ -55,6 +55,9 @@ const (
// LogsIndex is the index of the start of the log
LogsIndex SubKey = "LOGS_INDEX"
+
+ // ExamplesCatalog is catalog of examples available in Playground
+ ExamplesCatalog SubKey = "EXAMPLES_CATALOG"
Review comment:
Instead of make workarounds with subkey without pipeline id. Can we extend the Cache interface and implementation with SetCatalog, GetKatalog?
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r790873989
##########
File path: playground/backend/internal/cache/cache.go
##########
@@ -75,4 +79,10 @@ type Cache interface {
// SetExpTime adds expiration time of the pipeline to cache by pipelineId.
SetExpTime(ctx context.Context, pipelineId uuid.UUID, expTime time.Duration) error
+
+ // SetCatalog adds the given catalog to cache by ExamplesCatalog key.
+ SetCatalog(ctx context.Context, catalog []*pb.Categories) error
+
+ // GetCatalog return catalog from cache by ExamplesCatalog key.
+ GetCatalog(ctx context.Context) ([]*pb.Categories, error)
Review comment:
Yes, we save it without the workaround with nil pipelined as It was before.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r791534120
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -38,3 +40,54 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
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, its logic is connected with retrieving the data from the bucket – testing this will be integration testing, which we don't do now.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] AydarZaynutdinov commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
AydarZaynutdinov commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r784237568
##########
File path: playground/backend/cmd/server/controller.go
##########
@@ -241,22 +241,28 @@ func (controller *playgroundController) Cancel(ctx context.Context, info *pb.Can
}
// GetPrecompiledObjects returns the list of examples
+// - If SDK and category are unspecified in the request, gets the whole catalog from the cache
+// - If there is no catalog in the cache, gets the catalog from the Storage and saves it to the cache
+// - If SDK or category is specified in the request, gets the specific catalog from the Storage
func (controller *playgroundController) GetPrecompiledObjects(ctx context.Context, info *pb.GetPrecompiledObjectsRequest) (*pb.GetPrecompiledObjectsResponse, error) {
- bucket := cloud_bucket.New()
- sdkToCategories, err := bucket.GetPrecompiledObjects(ctx, info.Sdk, info.Category)
+ if info.Sdk == pb.Sdk_SDK_UNSPECIFIED && info.Category == "" {
+ catalog, err := utils.GetPrecompiledObjectsCatalogFromCache(ctx, controller.cacheService)
+ if err == nil {
+ return &pb.GetPrecompiledObjectsResponse{SdkCategories: catalog}, nil
+ } else {
+ logger.Errorf("GetPrecompiledObjects(): cache error: %s", err.Error())
+ }
Review comment:
```suggestion
}
logger.Errorf("GetPrecompiledObjects(): cache error: %s", err.Error())
```
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r791534120
##########
File path: playground/backend/internal/utils/precompiled_objects_utils.go
##########
@@ -38,3 +40,54 @@ func PutPrecompiledObjectsToCategory(categoryName string, precompiledObjects *cl
}
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, its logic is connected with retrieving the data from the bucket – testing this will be integration testing, which we don't do now.
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] KhaninArtur commented on a change in pull request #16493: [BEAM-13632][Playground] Save catalog data to the cache
Posted by GitBox <gi...@apache.org>.
KhaninArtur commented on a change in pull request #16493:
URL: https://github.com/apache/beam/pull/16493#discussion_r792456224
##########
File path: playground/backend/internal/cache/cache.go
##########
@@ -55,6 +55,9 @@ const (
// LogsIndex is the index of the start of the log
LogsIndex SubKey = "LOGS_INDEX"
+
+ // ExamplesCatalog is catalog of examples available in Playground
+ ExamplesCatalog SubKey = "EXAMPLES_CATALOG"
Review comment:
You are right, changed
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org