Skip to content

Commit

Permalink
chores: removed extra client settings for automl (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
munkhuushmgl authored and Shabirmean committed Nov 18, 2022
1 parent d93a1e8 commit 7998b51
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
15 changes: 1 addition & 14 deletions automl/snippets/src/main/java/com/beta/automl/ListDatasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,7 @@ static void listDatasets(String projectId) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
AutoMlSettings.Builder autoMlSettingsBuilder = AutoMlSettings.newBuilder();

autoMlSettingsBuilder
.listDatasetsSettings()
.setRetrySettings(
autoMlSettingsBuilder
.listDatasetsSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(15))
.build());
AutoMlSettings autoMlSettings = autoMlSettingsBuilder.build();

try (AutoMlClient client = AutoMlClient.create(autoMlSettings)) {
try (AutoMlClient client = AutoMlClient.create()) {
// A resource that represents Google Cloud Platform location.
LocationName projectLocation = LocationName.of(projectId, "us-central1");
ListDatasetsRequest request =
Expand Down
15 changes: 1 addition & 14 deletions automl/snippets/src/main/java/com/beta/automl/ListModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,7 @@ static void listModels(String projectId) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
AutoMlSettings.Builder autoMlSettingsBuilder = AutoMlSettings.newBuilder();

autoMlSettingsBuilder
.listModelsSettings()
.setRetrySettings(
autoMlSettingsBuilder
.listModelsSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
AutoMlSettings autoMlSettings = autoMlSettingsBuilder.build();

try (AutoMlClient client = AutoMlClient.create(autoMlSettings)) {
try (AutoMlClient client = AutoMlClient.create()) {
// A resource that represents Google Cloud Platform location.
LocationName projectLocation = LocationName.of(projectId, "us-central1");

Expand Down
15 changes: 1 addition & 14 deletions automl/snippets/src/main/java/com/example/automl/ListModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,7 @@ static void listModels(String projectId) throws IOException {
// Initialize client that will be used to send requests. This client only needs to be created
// once, and can be reused for multiple requests. After completing all of your requests, call
// the "close" method on the client to safely clean up any remaining background resources.
AutoMlSettings.Builder autoMlSettingsBuilder = AutoMlSettings.newBuilder();

autoMlSettingsBuilder
.listModelsSettings()
.setRetrySettings(
autoMlSettingsBuilder
.listModelsSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(20))
.build());
AutoMlSettings autoMlSettings = autoMlSettingsBuilder.build();

try (AutoMlClient client = AutoMlClient.create(autoMlSettings)) {
try (AutoMlClient client = AutoMlClient.create()) {
// A resource that represents Google Cloud Platform location.
LocationName projectLocation = LocationName.of(projectId, "us-central1");

Expand Down

0 comments on commit 7998b51

Please sign in to comment.