Skip to content

Conversation

@KhaninArtur
Copy link
Contributor

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:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • 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.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status Build Status Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status ---
XLang Build Status Build Status Build Status Build Status Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@KhaninArtur
Copy link
Contributor Author

R: @ilya-kozyrev

Copy link
Contributor

@AydarZaynutdinov AydarZaynutdinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Last minor suggestion.

Comment on lines 252 to 254
} else {
logger.Errorf("GetPrecompiledObjects(): cache error: %s", err.Error())
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
logger.Errorf("GetPrecompiledObjects(): cache error: %s", err.Error())
}
}
logger.Errorf("GetPrecompiledObjects(): cache error: %s", err.Error())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, thanks!

Copy link
Contributor

@pavel-avilov pavel-avilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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 == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we need this if here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed per our discussion

LogsIndex SubKey = "LOGS_INDEX"

// ExamplesCatalog is catalog of examples available in Playground
ExamplesCatalog SubKey = "EXAMPLES_CATALOG"
Copy link
Contributor

@ilya-kozyrev ilya-kozyrev Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of make workarounds with subkey without pipeline id. Can we extend the Cache interface and implementation with SetCatalog, GetKatalog?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, changed

}

// GetPrecompiledObjectsCatalogFromCache returns the precompiled objects catalog from the cache
func GetPrecompiledObjectsCatalogFromCache(ctx context.Context, cacheService cache.Cache) ([]*pb.Categories, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make this name shorter?
GetPrecompiledObjectsFromCache

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one became redundant and GetPrecompiledObjectsCatalogFromStorage I changed to GetCatalogFromStorage

@KhaninArtur KhaninArtur force-pushed the BEAM-13632-cache-examples-data branch from d93dc2b to 7fe3d8b Compare January 24, 2022 14:26
Comment on lines +83 to +87
// 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we use already existing methods GetValue and SetValue? Is it because we use Get/Set for catalog instead of HGet/HSet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we save it without the workaround with nil pipelined as It was before.

Comment on lines 244 to 246
// - 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing, changed!

Copy link
Contributor

@AydarZaynutdinov AydarZaynutdinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}

// GetCatalogFromStorage returns the precompiled objects catalog from the cloud storage
func GetCatalogFromStorage(ctx context.Context) ([]*pb.Categories, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add tests for this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, its logic is connected with retrieving the data from the bucket – testing this will be integration testing, which we don't do now.

# Conflicts:
#	playground/backend/internal/cache/cache.go
Copy link
Contributor

@daria-malkova daria-malkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@ilya-kozyrev ilya-kozyrev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks

@KhaninArtur
Copy link
Contributor Author

R: @pabloem

@pabloem
Copy link
Member

pabloem commented Jan 31, 2022

this looks fine to me. thanks!

@pabloem pabloem merged commit 4e5db10 into apache:master Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants