Class RecommendationAIImportCatalogItems
java.lang.Object
org.apache.beam.sdk.transforms.PTransform<PCollection<KV<String,com.google.api.client.json.GenericJson>>,PCollectionTuple>
org.apache.beam.sdk.extensions.ml.RecommendationAIImportCatalogItems
- All Implemented Interfaces:
Serializable
,HasDisplayData
public abstract class RecommendationAIImportCatalogItems
extends PTransform<PCollection<KV<String,com.google.api.client.json.GenericJson>>,PCollectionTuple>
A
PTransform
connecting to the Recommendations AI API
(https://cloud.google.com/recommendations) and creating CatalogItem
s. *
Batch size defines how many items are created at once per batch (max: 5000).
The transform consumes KV
of String
and GenericJson
s (assumed to be
the catalog item id as key and contents as value) and outputs a PCollectionTuple which will
contain the successfully created and failed catalog items.
It is possible to provide a catalog name to which you want to add the catalog item (defaults to "default_catalog").
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TupleTag
<com.google.cloud.recommendationengine.v1beta1.CatalogItem> static final TupleTag
<com.google.cloud.recommendationengine.v1beta1.CatalogItem> Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Integer
expand
(PCollection<KV<String, com.google.api.client.json.GenericJson>> input) The transform converts the contents of input PCollection intoCatalogItem
s and then calls the Recommendation AI service to create the catalog item.abstract Duration
withBatchSize
(Integer batchSize) withCatalogName
(String catalogName) withProjectId
(String projectId) Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
-
Field Details
-
SUCCESS_TAG
-
FAILURE_TAG
-
-
Constructor Details
-
RecommendationAIImportCatalogItems
public RecommendationAIImportCatalogItems()
-
-
Method Details
-
projectId
- Returns:
- ID of Google Cloud project to be used for creating catalog items.
-
catalogName
- Returns:
- Name of the catalog where the catalog items will be created.
-
batchSize
- Returns:
- Size of input elements batch to be sent in one request.
-
maxBufferingDuration
- Returns:
- Time limit (in processing time) on how long an incomplete batch of elements is allowed to be buffered.
-
withProjectId
-
withCatalogName
-
withBatchSize
-
expand
public PCollectionTuple expand(PCollection<KV<String, com.google.api.client.json.GenericJson>> input) The transform converts the contents of input PCollection intoCatalogItem
s and then calls the Recommendation AI service to create the catalog item.- Specified by:
expand
in classPTransform<PCollection<KV<String,
com.google.api.client.json.GenericJson>>, PCollectionTuple> - Parameters:
input
- input PCollection- Returns:
- PCollection after transformations
-