Class VizierServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
Vertex AI Vizier is a service to solve blackbox optimization problems, such as tuning machine learning hyperparameters and searching over deep learning architectures.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Study study = Study.newBuilder().build();
Study response = vizierServiceClient.createStudy(parent, study);
}
Note: close() needs to be called on the VizierServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateStudy |
Creates a Study. A resource name will be generated after creation of the Study. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetStudy |
Gets a Study by name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListStudies |
Lists all the studies in a region for an associated project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteStudy |
Deletes a Study. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
LookupStudy |
Looks a study up using the user-defined display_name field instead of the fully qualified resource name. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SuggestTrials |
Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation associated with the generation of Trial suggestions. When this long-running operation succeeds, it will contain a [SuggestTrialsResponse][google.cloud.aiplatform.v1beta1.SuggestTrialsResponse]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateTrial |
Adds a user provided Trial to a Study. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetTrial |
Gets a Trial. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListTrials |
Lists the Trials associated with a Study. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AddTrialMeasurement |
Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken before the Trial is complete. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CompleteTrial |
Marks a Trial as complete. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteTrial |
Deletes a Trial. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CheckTrialEarlyStoppingState |
Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it will contain a [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateResponse]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
StopTrial |
Stops a Trial. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListOptimalTrials |
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of pareto-optimal can be checked in wiki page. https://en.wikipedia.org/wiki/Pareto_efficiency |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets the access control policy on the specified resource. Replacesany existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of VizierServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
VizierServiceSettings vizierServiceSettings =
VizierServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
VizierServiceSettings vizierServiceSettings =
VizierServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedVizierServiceClient(VizierServiceSettings settings) Constructs an instance of VizierServiceClient, using the given settings. -
Method Summary
Modifier and TypeMethodDescriptionfinal TrialAdds a measurement of the objective metrics to a Trial.Adds a measurement of the objective metrics to a Trial.booleanawaitTermination(long duration, TimeUnit unit) Checks whether a Trial should stop or not.Checks whether a Trial should stop or not.final OperationCallable<CheckTrialEarlyStoppingStateRequest,CheckTrialEarlyStoppingStateResponse, CheckTrialEarlyStoppingStateMetatdata> Checks whether a Trial should stop or not.final voidclose()final TrialcompleteTrial(CompleteTrialRequest request) Marks a Trial as complete.Marks a Trial as complete.static final VizierServiceClientcreate()Constructs an instance of VizierServiceClient with default settings.static final VizierServiceClientcreate(VizierServiceStub stub) Constructs an instance of VizierServiceClient, using the given stub for making calls.static final VizierServiceClientcreate(VizierServiceSettings settings) Constructs an instance of VizierServiceClient, using the given settings.final StudycreateStudy(CreateStudyRequest request) Creates a Study.final StudycreateStudy(LocationName parent, Study study) Creates a Study.final StudycreateStudy(String parent, Study study) Creates a Study.final UnaryCallable<CreateStudyRequest,Study> Creates a Study.final TrialcreateTrial(CreateTrialRequest request) Adds a user provided Trial to a Study.final TrialcreateTrial(StudyName parent, Trial trial) Adds a user provided Trial to a Study.final TrialcreateTrial(String parent, Trial trial) Adds a user provided Trial to a Study.final UnaryCallable<CreateTrialRequest,Trial> Adds a user provided Trial to a Study.final voiddeleteStudy(DeleteStudyRequest request) Deletes a Study.final voiddeleteStudy(StudyName name) Deletes a Study.final voiddeleteStudy(String name) Deletes a Study.final UnaryCallable<DeleteStudyRequest,com.google.protobuf.Empty> Deletes a Study.final voiddeleteTrial(DeleteTrialRequest request) Deletes a Trial.final voiddeleteTrial(TrialName name) Deletes a Trial.final voiddeleteTrial(String name) Deletes a Trial.final UnaryCallable<DeleteTrialRequest,com.google.protobuf.Empty> Deletes a Trial.final PolicygetIamPolicy(GetIamPolicyRequest request) Gets the access control policy for a resource.Gets the access control policy for a resource.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.final OperationsClientReturns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.final VizierServiceSettingsgetStub()final StudygetStudy(GetStudyRequest request) Gets a Study by name.final StudyGets a Study by name.final StudyGets a Study by name.final UnaryCallable<GetStudyRequest,Study> Gets a Study by name.final TrialgetTrial(GetTrialRequest request) Gets a Trial.final TrialGets a Trial.final TrialGets a Trial.final UnaryCallable<GetTrialRequest,Trial> Gets a Trial.booleanbooleanlistLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study.listOptimalTrials(StudyName parent) Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study.listOptimalTrials(String parent) Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study.Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study.listStudies(ListStudiesRequest request) Lists all the studies in a region for an associated project.listStudies(LocationName parent) Lists all the studies in a region for an associated project.listStudies(String parent) Lists all the studies in a region for an associated project.Lists all the studies in a region for an associated project.Lists all the studies in a region for an associated project.listTrials(ListTrialsRequest request) Lists the Trials associated with a Study.listTrials(StudyName parent) Lists the Trials associated with a Study.listTrials(String parent) Lists the Trials associated with a Study.Lists the Trials associated with a Study.Lists the Trials associated with a Study.final StudylookupStudy(LocationName parent) Looks a study up using the user-defined display_name field instead of the fully qualified resource name.final StudylookupStudy(LookupStudyRequest request) Looks a study up using the user-defined display_name field instead of the fully qualified resource name.final StudylookupStudy(String parent) Looks a study up using the user-defined display_name field instead of the fully qualified resource name.final UnaryCallable<LookupStudyRequest,Study> Looks a study up using the user-defined display_name field instead of the fully qualified resource name.final PolicysetIamPolicy(SetIamPolicyRequest request) Sets the access control policy on the specified resource.Sets the access control policy on the specified resource.voidshutdown()voidfinal TrialstopTrial(StopTrialRequest request) Stops a Trial.final UnaryCallable<StopTrialRequest,Trial> Stops a Trial.suggestTrialsAsync(SuggestTrialsRequest request) Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier.Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier.Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier.Returns permissions that a caller has on the specified resource.Returns permissions that a caller has on the specified resource.
-
Constructor Details
-
VizierServiceClient
Constructs an instance of VizierServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
VizierServiceClient
-
-
Method Details
-
create
Constructs an instance of VizierServiceClient with default settings.- Throws:
IOException
-
create
Constructs an instance of VizierServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of VizierServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(VizierServiceSettings). -
getSettings
-
getStub
-
getOperationsClient
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call. -
createStudy
Creates a Study. A resource name will be generated after creation of the Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Study study = Study.newBuilder().build(); Study response = vizierServiceClient.createStudy(parent, study); }- Parameters:
parent- Required. The resource name of the Location to create the CustomJob in. Format: `projects/{project}/locations/{location}`study- Required. The Study configuration used to create the Study.- Throws:
ApiException- if the remote call fails
-
createStudy
Creates a Study. A resource name will be generated after creation of the Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Study study = Study.newBuilder().build(); Study response = vizierServiceClient.createStudy(parent, study); }- Parameters:
parent- Required. The resource name of the Location to create the CustomJob in. Format: `projects/{project}/locations/{location}`study- Required. The Study configuration used to create the Study.- Throws:
ApiException- if the remote call fails
-
createStudy
Creates a Study. A resource name will be generated after creation of the Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CreateStudyRequest request = CreateStudyRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setStudy(Study.newBuilder().build()) .build(); Study response = vizierServiceClient.createStudy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createStudyCallable
Creates a Study. A resource name will be generated after creation of the Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CreateStudyRequest request = CreateStudyRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setStudy(Study.newBuilder().build()) .build(); ApiFuture<Study> future = vizierServiceClient.createStudyCallable().futureCall(request); // Do something. Study response = future.get(); } -
getStudy
Gets a Study by name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); Study response = vizierServiceClient.getStudy(name); }- Parameters:
name- Required. The name of the Study resource. Format: `projects/{project}/locations/{location}/studies/{study}`- Throws:
ApiException- if the remote call fails
-
getStudy
Gets a Study by name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); Study response = vizierServiceClient.getStudy(name); }- Parameters:
name- Required. The name of the Study resource. Format: `projects/{project}/locations/{location}/studies/{study}`- Throws:
ApiException- if the remote call fails
-
getStudy
Gets a Study by name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetStudyRequest request = GetStudyRequest.newBuilder() .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .build(); Study response = vizierServiceClient.getStudy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getStudyCallable
Gets a Study by name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetStudyRequest request = GetStudyRequest.newBuilder() .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .build(); ApiFuture<Study> future = vizierServiceClient.getStudyCallable().futureCall(request); // Do something. Study response = future.get(); } -
listStudies
Lists all the studies in a region for an associated project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Location to list the Study from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
listStudies
Lists all the studies in a region for an associated project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Location to list the Study from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
listStudies
Lists all the studies in a region for an associated project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListStudiesRequest request = ListStudiesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (Study element : vizierServiceClient.listStudies(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listStudiesPagedCallable
public final UnaryCallable<ListStudiesRequest,VizierServiceClient.ListStudiesPagedResponse> listStudiesPagedCallable()Lists all the studies in a region for an associated project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListStudiesRequest request = ListStudiesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<Study> future = vizierServiceClient.listStudiesPagedCallable().futureCall(request); // Do something. for (Study element : future.get().iterateAll()) { // doThingsWith(element); } } -
listStudiesCallable
Lists all the studies in a region for an associated project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListStudiesRequest request = ListStudiesRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListStudiesResponse response = vizierServiceClient.listStudiesCallable().call(request); for (Study element : response.getStudiesList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
deleteStudy
Deletes a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); vizierServiceClient.deleteStudy(name); }- Parameters:
name- Required. The name of the Study resource to be deleted. Format: `projects/{project}/locations/{location}/studies/{study}`- Throws:
ApiException- if the remote call fails
-
deleteStudy
Deletes a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); vizierServiceClient.deleteStudy(name); }- Parameters:
name- Required. The name of the Study resource to be deleted. Format: `projects/{project}/locations/{location}/studies/{study}`- Throws:
ApiException- if the remote call fails
-
deleteStudy
Deletes a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { DeleteStudyRequest request = DeleteStudyRequest.newBuilder() .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .build(); vizierServiceClient.deleteStudy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteStudyCallable
Deletes a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { DeleteStudyRequest request = DeleteStudyRequest.newBuilder() .setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .build(); ApiFuture<Empty> future = vizierServiceClient.deleteStudyCallable().futureCall(request); // Do something. future.get(); } -
lookupStudy
Looks a study up using the user-defined display_name field instead of the fully qualified resource name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Study response = vizierServiceClient.lookupStudy(parent); }- Parameters:
parent- Required. The resource name of the Location to get the Study from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
lookupStudy
Looks a study up using the user-defined display_name field instead of the fully qualified resource name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Study response = vizierServiceClient.lookupStudy(parent); }- Parameters:
parent- Required. The resource name of the Location to get the Study from. Format: `projects/{project}/locations/{location}`- Throws:
ApiException- if the remote call fails
-
lookupStudy
Looks a study up using the user-defined display_name field instead of the fully qualified resource name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { LookupStudyRequest request = LookupStudyRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setDisplayName("displayName1714148973") .build(); Study response = vizierServiceClient.lookupStudy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
lookupStudyCallable
Looks a study up using the user-defined display_name field instead of the fully qualified resource name.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { LookupStudyRequest request = LookupStudyRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setDisplayName("displayName1714148973") .build(); ApiFuture<Study> future = vizierServiceClient.lookupStudyCallable().futureCall(request); // Do something. Study response = future.get(); } -
suggestTrialsAsync
public final OperationFuture<SuggestTrialsResponse,SuggestTrialsMetadata> suggestTrialsAsync(SuggestTrialsRequest request) Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation associated with the generation of Trial suggestions. When this long-running operation succeeds, it will contain a [SuggestTrialsResponse][google.cloud.aiplatform.v1beta1.SuggestTrialsResponse].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { SuggestTrialsRequest request = SuggestTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setSuggestionCount(390130452) .setClientId("clientId908408390") .addAllContexts(new ArrayList<TrialContext>()) .build(); SuggestTrialsResponse response = vizierServiceClient.suggestTrialsAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
suggestTrialsOperationCallable
public final OperationCallable<SuggestTrialsRequest,SuggestTrialsResponse, suggestTrialsOperationCallable()SuggestTrialsMetadata> Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation associated with the generation of Trial suggestions. When this long-running operation succeeds, it will contain a [SuggestTrialsResponse][google.cloud.aiplatform.v1beta1.SuggestTrialsResponse].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { SuggestTrialsRequest request = SuggestTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setSuggestionCount(390130452) .setClientId("clientId908408390") .addAllContexts(new ArrayList<TrialContext>()) .build(); OperationFuture<SuggestTrialsResponse, SuggestTrialsMetadata> future = vizierServiceClient.suggestTrialsOperationCallable().futureCall(request); // Do something. SuggestTrialsResponse response = future.get(); } -
suggestTrialsCallable
Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation associated with the generation of Trial suggestions. When this long-running operation succeeds, it will contain a [SuggestTrialsResponse][google.cloud.aiplatform.v1beta1.SuggestTrialsResponse].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { SuggestTrialsRequest request = SuggestTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setSuggestionCount(390130452) .setClientId("clientId908408390") .addAllContexts(new ArrayList<TrialContext>()) .build(); ApiFuture<Operation> future = vizierServiceClient.suggestTrialsCallable().futureCall(request); // Do something. Operation response = future.get(); } -
createTrial
Adds a user provided Trial to a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); Trial trial = Trial.newBuilder().build(); Trial response = vizierServiceClient.createTrial(parent, trial); }- Parameters:
parent- Required. The resource name of the Study to create the Trial in. Format: `projects/{project}/locations/{location}/studies/{study}`trial- Required. The Trial to create.- Throws:
ApiException- if the remote call fails
-
createTrial
Adds a user provided Trial to a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); Trial trial = Trial.newBuilder().build(); Trial response = vizierServiceClient.createTrial(parent, trial); }- Parameters:
parent- Required. The resource name of the Study to create the Trial in. Format: `projects/{project}/locations/{location}/studies/{study}`trial- Required. The Trial to create.- Throws:
ApiException- if the remote call fails
-
createTrial
Adds a user provided Trial to a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CreateTrialRequest request = CreateTrialRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setTrial(Trial.newBuilder().build()) .build(); Trial response = vizierServiceClient.createTrial(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createTrialCallable
Adds a user provided Trial to a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CreateTrialRequest request = CreateTrialRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setTrial(Trial.newBuilder().build()) .build(); ApiFuture<Trial> future = vizierServiceClient.createTrialCallable().futureCall(request); // Do something. Trial response = future.get(); } -
getTrial
Gets a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]"); Trial response = vizierServiceClient.getTrial(name); }- Parameters:
name- Required. The name of the Trial resource. Format: `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`- Throws:
ApiException- if the remote call fails
-
getTrial
Gets a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString(); Trial response = vizierServiceClient.getTrial(name); }- Parameters:
name- Required. The name of the Trial resource. Format: `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`- Throws:
ApiException- if the remote call fails
-
getTrial
Gets a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetTrialRequest request = GetTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); Trial response = vizierServiceClient.getTrial(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getTrialCallable
Gets a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetTrialRequest request = GetTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); ApiFuture<Trial> future = vizierServiceClient.getTrialCallable().futureCall(request); // Do something. Trial response = future.get(); } -
listTrials
Lists the Trials associated with a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Study to list the Trial from. Format: `projects/{project}/locations/{location}/studies/{study}`- Throws:
ApiException- if the remote call fails
-
listTrials
Lists the Trials associated with a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the Study to list the Trial from. Format: `projects/{project}/locations/{location}/studies/{study}`- Throws:
ApiException- if the remote call fails
-
listTrials
Lists the Trials associated with a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListTrialsRequest request = ListTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); for (Trial element : vizierServiceClient.listTrials(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listTrialsPagedCallable
public final UnaryCallable<ListTrialsRequest,VizierServiceClient.ListTrialsPagedResponse> listTrialsPagedCallable()Lists the Trials associated with a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListTrialsRequest request = ListTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); ApiFuture<Trial> future = vizierServiceClient.listTrialsPagedCallable().futureCall(request); // Do something. for (Trial element : future.get().iterateAll()) { // doThingsWith(element); } } -
listTrialsCallable
Lists the Trials associated with a Study.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListTrialsRequest request = ListTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .setPageToken("pageToken873572522") .setPageSize(883849137) .build(); while (true) { ListTrialsResponse response = vizierServiceClient.listTrialsCallable().call(request); for (Trial element : response.getTrialsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
addTrialMeasurement
Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken before the Trial is complete.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { AddTrialMeasurementRequest request = AddTrialMeasurementRequest.newBuilder() .setTrialName( TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .setMeasurement(Measurement.newBuilder().build()) .build(); Trial response = vizierServiceClient.addTrialMeasurement(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
addTrialMeasurementCallable
Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken before the Trial is complete.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { AddTrialMeasurementRequest request = AddTrialMeasurementRequest.newBuilder() .setTrialName( TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .setMeasurement(Measurement.newBuilder().build()) .build(); ApiFuture<Trial> future = vizierServiceClient.addTrialMeasurementCallable().futureCall(request); // Do something. Trial response = future.get(); } -
completeTrial
Marks a Trial as complete.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CompleteTrialRequest request = CompleteTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .setFinalMeasurement(Measurement.newBuilder().build()) .setTrialInfeasible(true) .setInfeasibleReason("infeasibleReason1040725388") .build(); Trial response = vizierServiceClient.completeTrial(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
completeTrialCallable
Marks a Trial as complete.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CompleteTrialRequest request = CompleteTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .setFinalMeasurement(Measurement.newBuilder().build()) .setTrialInfeasible(true) .setInfeasibleReason("infeasibleReason1040725388") .build(); ApiFuture<Trial> future = vizierServiceClient.completeTrialCallable().futureCall(request); // Do something. Trial response = future.get(); } -
deleteTrial
Deletes a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]"); vizierServiceClient.deleteTrial(name); }- Parameters:
name- Required. The Trial's name. Format: `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`- Throws:
ApiException- if the remote call fails
-
deleteTrial
Deletes a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString(); vizierServiceClient.deleteTrial(name); }- Parameters:
name- Required. The Trial's name. Format: `projects/{project}/locations/{location}/studies/{study}/trials/{trial}`- Throws:
ApiException- if the remote call fails
-
deleteTrial
Deletes a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { DeleteTrialRequest request = DeleteTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); vizierServiceClient.deleteTrial(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteTrialCallable
Deletes a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { DeleteTrialRequest request = DeleteTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); ApiFuture<Empty> future = vizierServiceClient.deleteTrialCallable().futureCall(request); // Do something. future.get(); } -
checkTrialEarlyStoppingStateAsync
public final OperationFuture<CheckTrialEarlyStoppingStateResponse,CheckTrialEarlyStoppingStateMetatdata> checkTrialEarlyStoppingStateAsync(CheckTrialEarlyStoppingStateRequest request) Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it will contain a [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateResponse].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CheckTrialEarlyStoppingStateRequest request = CheckTrialEarlyStoppingStateRequest.newBuilder() .setTrialName( TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); CheckTrialEarlyStoppingStateResponse response = vizierServiceClient.checkTrialEarlyStoppingStateAsync(request).get(); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
checkTrialEarlyStoppingStateOperationCallable
public final OperationCallable<CheckTrialEarlyStoppingStateRequest,CheckTrialEarlyStoppingStateResponse, checkTrialEarlyStoppingStateOperationCallable()CheckTrialEarlyStoppingStateMetatdata> Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it will contain a [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateResponse].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CheckTrialEarlyStoppingStateRequest request = CheckTrialEarlyStoppingStateRequest.newBuilder() .setTrialName( TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); OperationFuture<CheckTrialEarlyStoppingStateResponse, CheckTrialEarlyStoppingStateMetatdata> future = vizierServiceClient .checkTrialEarlyStoppingStateOperationCallable() .futureCall(request); // Do something. CheckTrialEarlyStoppingStateResponse response = future.get(); } -
checkTrialEarlyStoppingStateCallable
public final UnaryCallable<CheckTrialEarlyStoppingStateRequest,Operation> checkTrialEarlyStoppingStateCallable()Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it will contain a [CheckTrialEarlyStoppingStateResponse][google.cloud.aiplatform.v1beta1.CheckTrialEarlyStoppingStateResponse].Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { CheckTrialEarlyStoppingStateRequest request = CheckTrialEarlyStoppingStateRequest.newBuilder() .setTrialName( TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); ApiFuture<Operation> future = vizierServiceClient.checkTrialEarlyStoppingStateCallable().futureCall(request); // Do something. Operation response = future.get(); } -
stopTrial
Stops a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StopTrialRequest request = StopTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); Trial response = vizierServiceClient.stopTrial(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
stopTrialCallable
Stops a Trial.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StopTrialRequest request = StopTrialRequest.newBuilder() .setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString()) .build(); ApiFuture<Trial> future = vizierServiceClient.stopTrialCallable().futureCall(request); // Do something. Trial response = future.get(); } -
listOptimalTrials
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of pareto-optimal can be checked in wiki page. https://en.wikipedia.org/wiki/Pareto_efficiencySample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]"); ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent); }- Parameters:
parent- Required. The name of the Study that the optimal Trial belongs to.- Throws:
ApiException- if the remote call fails
-
listOptimalTrials
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of pareto-optimal can be checked in wiki page. https://en.wikipedia.org/wiki/Pareto_efficiencySample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString(); ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent); }- Parameters:
parent- Required. The name of the Study that the optimal Trial belongs to.- Throws:
ApiException- if the remote call fails
-
listOptimalTrials
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of pareto-optimal can be checked in wiki page. https://en.wikipedia.org/wiki/Pareto_efficiencySample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListOptimalTrialsRequest request = ListOptimalTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .build(); ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listOptimalTrialsCallable
public final UnaryCallable<ListOptimalTrialsRequest,ListOptimalTrialsResponse> listOptimalTrialsCallable()Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of pareto-optimal can be checked in wiki page. https://en.wikipedia.org/wiki/Pareto_efficiencySample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListOptimalTrialsRequest request = ListOptimalTrialsRequest.newBuilder() .setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString()) .build(); ApiFuture<ListOptimalTrialsResponse> future = vizierServiceClient.listOptimalTrialsCallable().futureCall(request); // Do something. ListOptimalTrialsResponse response = future.get(); } -
listLocations
public final VizierServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : vizierServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,VizierServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = vizierServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = vizierServiceClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = vizierServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = vizierServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
setIamPolicy
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = vizierServiceClient.setIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = vizierServiceClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
getIamPolicy
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = vizierServiceClient.getIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = vizierServiceClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
testIamPermissions
Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = vizierServiceClient.testIamPermissions(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<TestIamPermissionsRequest,TestIamPermissionsResponse> testIamPermissionsCallable()Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( EndpointName.ofProjectLocationEndpointName( "[PROJECT]", "[LOCATION]", "[ENDPOINT]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = vizierServiceClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-