24
24
// [START aiplatform_create_featurestore_fixed_nodes_sample]
25
25
26
26
import com .google .api .gax .longrunning .OperationFuture ;
27
+ import com .google .api .gax .longrunning .OperationTimedPollAlgorithm ;
28
+ import com .google .api .gax .retrying .RetrySettings ;
27
29
import com .google .cloud .aiplatform .v1beta1 .CreateFeaturestoreOperationMetadata ;
28
30
import com .google .cloud .aiplatform .v1beta1 .CreateFeaturestoreRequest ;
29
31
import com .google .cloud .aiplatform .v1beta1 .Featurestore ;
30
32
import com .google .cloud .aiplatform .v1beta1 .Featurestore .OnlineServingConfig ;
31
33
import com .google .cloud .aiplatform .v1beta1 .FeaturestoreServiceClient ;
32
34
import com .google .cloud .aiplatform .v1beta1 .FeaturestoreServiceSettings ;
33
35
import com .google .cloud .aiplatform .v1beta1 .LocationName ;
36
+ import com .google .cloud .aiplatform .v1beta1 .stub .FeaturestoreServiceStubSettings ;
34
37
import java .io .IOException ;
35
38
import java .util .concurrent .ExecutionException ;
36
39
import java .util .concurrent .TimeUnit ;
37
40
import java .util .concurrent .TimeoutException ;
41
+ import org .threeten .bp .Duration ;
38
42
39
43
public class CreateFeaturestoreFixedNodesSample {
40
44
@@ -60,8 +64,30 @@ static void createFeaturestoreFixedNodesSample(
60
64
int timeout )
61
65
throws IOException , InterruptedException , ExecutionException , TimeoutException {
62
66
67
+ OperationTimedPollAlgorithm operationTimedPollAlgorithm =
68
+ OperationTimedPollAlgorithm .create (
69
+ RetrySettings .newBuilder ()
70
+ .setInitialRetryDelay (Duration .ofMillis (5000L ))
71
+ .setRetryDelayMultiplier (1.5 )
72
+ .setMaxRetryDelay (Duration .ofMillis (45000L ))
73
+ .setInitialRpcTimeout (Duration .ZERO )
74
+ .setRpcTimeoutMultiplier (1.0 )
75
+ .setMaxRpcTimeout (Duration .ZERO )
76
+ .setTotalTimeout (Duration .ofSeconds (timeout ))
77
+ .build ());
78
+
79
+ FeaturestoreServiceStubSettings .Builder featurestoreServiceStubSettingsBuilder =
80
+ FeaturestoreServiceStubSettings .newBuilder ();
81
+
82
+ featurestoreServiceStubSettingsBuilder
83
+ .createFeaturestoreOperationSettings ()
84
+ .setPollingAlgorithm (operationTimedPollAlgorithm );
85
+ FeaturestoreServiceStubSettings featureStoreStubSettings =
86
+ featurestoreServiceStubSettingsBuilder .build ();
63
87
FeaturestoreServiceSettings featurestoreServiceSettings =
64
- FeaturestoreServiceSettings .newBuilder ().setEndpoint (endpoint ).build ();
88
+ FeaturestoreServiceSettings .create (featureStoreStubSettings );
89
+ featurestoreServiceSettings =
90
+ featurestoreServiceSettings .toBuilder ().setEndpoint (endpoint ).build ();
65
91
66
92
// Initialize client that will be used to send requests. This client only needs to be created
67
93
// once, and can be reused for multiple requests. After completing all of your requests, call
0 commit comments