Reference documentation and code samples for the Google Cloud Ai Platform V1 Client class JobServiceClient.
Service Description: A service for creating and managing Vertex AI's jobs.
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:
$jobServiceClient = new JobServiceClient();
try {
$formattedName = $jobServiceClient->batchPredictionJobName('[PROJECT]', '[LOCATION]', '[BATCH_PREDICTION_JOB]');
$jobServiceClient->cancelBatchPredictionJob($formattedName);
} finally {
$jobServiceClient->close();
}
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 parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
This service has a new (beta) implementation. See Google\Cloud\AIPlatform\V1\Client\JobServiceClient to use the new surface.
Namespace
Google \ Cloud \ AIPlatform \ V1Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
cancelBatchPredictionJob
Cancels a BatchPredictionJob.
Starts asynchronous cancellation on the BatchPredictionJob. The server
makes the best effort to cancel the job, but success is not
guaranteed. Clients can use
JobService.GetBatchPredictionJob
or other methods to check whether the cancellation succeeded or whether the
job completed despite cancellation. On a successful cancellation,
the BatchPredictionJob is not deleted;instead its
BatchPredictionJob.state
is set to CANCELLED
. Any files already outputted by the job are not
deleted.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the BatchPredictionJob to cancel.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\CancelBatchPredictionJobRequest;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
/**
* @param string $formattedName The name of the BatchPredictionJob to cancel.
* Format:
* `projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}`
* Please see {@see JobServiceClient::batchPredictionJobName()} for help formatting this field.
*/
function cancel_batch_prediction_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new CancelBatchPredictionJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->cancelBatchPredictionJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::batchPredictionJobName(
'[PROJECT]',
'[LOCATION]',
'[BATCH_PREDICTION_JOB]'
);
cancel_batch_prediction_job_sample($formattedName);
}
cancelCustomJob
Cancels a CustomJob.
Starts asynchronous cancellation on the CustomJob. The server
makes a best effort to cancel the job, but success is not
guaranteed. Clients can use
JobService.GetCustomJob
or other methods to check whether the cancellation succeeded or whether the
job completed despite cancellation. On successful cancellation,
the CustomJob is not deleted; instead it becomes a job with
a CustomJob.error value with
a google.rpc.Status.code of 1, corresponding to
Code.CANCELLED
, and
CustomJob.state is set to
CANCELLED
.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the CustomJob to cancel.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\CancelCustomJobRequest;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
/**
* @param string $formattedName The name of the CustomJob to cancel.
* Format:
* `projects/{project}/locations/{location}/customJobs/{custom_job}`
* Please see {@see JobServiceClient::customJobName()} for help formatting this field.
*/
function cancel_custom_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new CancelCustomJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->cancelCustomJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]');
cancel_custom_job_sample($formattedName);
}
cancelDataLabelingJob
Cancels a DataLabelingJob. Success of cancellation is not guaranteed.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the DataLabelingJob.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\CancelDataLabelingJobRequest;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
/**
* @param string $formattedName The name of the DataLabelingJob.
* Format:
* `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}`
* Please see {@see JobServiceClient::dataLabelingJobName()} for help formatting this field.
*/
function cancel_data_labeling_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new CancelDataLabelingJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->cancelDataLabelingJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::dataLabelingJobName(
'[PROJECT]',
'[LOCATION]',
'[DATA_LABELING_JOB]'
);
cancel_data_labeling_job_sample($formattedName);
}
cancelHyperparameterTuningJob
Cancels a HyperparameterTuningJob.
Starts asynchronous cancellation on the HyperparameterTuningJob. The server
makes a best effort to cancel the job, but success is not
guaranteed. Clients can use
JobService.GetHyperparameterTuningJob
or other methods to check whether the cancellation succeeded or whether the
job completed despite cancellation. On successful cancellation,
the HyperparameterTuningJob is not deleted; instead it becomes a job with
a
HyperparameterTuningJob.error
value with a google.rpc.Status.code of 1,
corresponding to Code.CANCELLED
, and
HyperparameterTuningJob.state
is set to CANCELLED
.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the HyperparameterTuningJob to cancel.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\CancelHyperparameterTuningJobRequest;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
/**
* @param string $formattedName The name of the HyperparameterTuningJob to cancel.
* Format:
* `projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}`
* Please see {@see JobServiceClient::hyperparameterTuningJobName()} for help formatting this field.
*/
function cancel_hyperparameter_tuning_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new CancelHyperparameterTuningJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->cancelHyperparameterTuningJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::hyperparameterTuningJobName(
'[PROJECT]',
'[LOCATION]',
'[HYPERPARAMETER_TUNING_JOB]'
);
cancel_hyperparameter_tuning_job_sample($formattedName);
}
cancelNasJob
Cancels a NasJob.
Starts asynchronous cancellation on the NasJob. The server
makes a best effort to cancel the job, but success is not
guaranteed. Clients can use
JobService.GetNasJob or
other methods to check whether the cancellation succeeded or whether the
job completed despite cancellation. On successful cancellation,
the NasJob is not deleted; instead it becomes a job with
a NasJob.error value with a
google.rpc.Status.code of 1, corresponding to
Code.CANCELLED
, and
NasJob.state is set to
CANCELLED
.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the NasJob to cancel.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\CancelNasJobRequest;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
/**
* @param string $formattedName The name of the NasJob to cancel.
* Format:
* `projects/{project}/locations/{location}/nasJobs/{nas_job}`
* Please see {@see JobServiceClient::nasJobName()} for help formatting this field.
*/
function cancel_nas_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new CancelNasJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->cancelNasJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]');
cancel_nas_job_sample($formattedName);
}
createBatchPredictionJob
Creates a BatchPredictionJob. A BatchPredictionJob once created will right away be attempted to start.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to create the
BatchPredictionJob in. Format: |
batchPredictionJob |
Google\Cloud\AIPlatform\V1\BatchPredictionJob
Required. The BatchPredictionJob to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\BatchPredictionJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\BatchPredictionJob;
use Google\Cloud\AIPlatform\V1\BatchPredictionJob\InputConfig;
use Google\Cloud\AIPlatform\V1\BatchPredictionJob\OutputConfig;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CreateBatchPredictionJobRequest;
/**
* @param string $formattedParent The resource name of the Location to create the
* BatchPredictionJob in. Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
* @param string $batchPredictionJobDisplayName The user-defined name of this BatchPredictionJob.
* @param string $batchPredictionJobInputConfigInstancesFormat The format in which instances are given, must be one of the
* [Model's][google.cloud.aiplatform.v1.BatchPredictionJob.model]
* [supported_input_storage_formats][google.cloud.aiplatform.v1.Model.supported_input_storage_formats].
* @param string $batchPredictionJobOutputConfigPredictionsFormat The format in which Vertex AI gives the predictions, must be
* one of the [Model's][google.cloud.aiplatform.v1.BatchPredictionJob.model]
* [supported_output_storage_formats][google.cloud.aiplatform.v1.Model.supported_output_storage_formats].
*/
function create_batch_prediction_job_sample(
string $formattedParent,
string $batchPredictionJobDisplayName,
string $batchPredictionJobInputConfigInstancesFormat,
string $batchPredictionJobOutputConfigPredictionsFormat
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$batchPredictionJobInputConfig = (new InputConfig())
->setInstancesFormat($batchPredictionJobInputConfigInstancesFormat);
$batchPredictionJobOutputConfig = (new OutputConfig())
->setPredictionsFormat($batchPredictionJobOutputConfigPredictionsFormat);
$batchPredictionJob = (new BatchPredictionJob())
->setDisplayName($batchPredictionJobDisplayName)
->setInputConfig($batchPredictionJobInputConfig)
->setOutputConfig($batchPredictionJobOutputConfig);
$request = (new CreateBatchPredictionJobRequest())
->setParent($formattedParent)
->setBatchPredictionJob($batchPredictionJob);
// Call the API and handle any network failures.
try {
/** @var BatchPredictionJob $response */
$response = $jobServiceClient->createBatchPredictionJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
$batchPredictionJobDisplayName = '[DISPLAY_NAME]';
$batchPredictionJobInputConfigInstancesFormat = '[INSTANCES_FORMAT]';
$batchPredictionJobOutputConfigPredictionsFormat = '[PREDICTIONS_FORMAT]';
create_batch_prediction_job_sample(
$formattedParent,
$batchPredictionJobDisplayName,
$batchPredictionJobInputConfigInstancesFormat,
$batchPredictionJobOutputConfigPredictionsFormat
);
}
createCustomJob
Creates a CustomJob. A created CustomJob right away will be attempted to be run.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to create the CustomJob in.
Format: |
customJob |
Google\Cloud\AIPlatform\V1\CustomJob
Required. The CustomJob to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\CustomJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CreateCustomJobRequest;
use Google\Cloud\AIPlatform\V1\CustomJob;
use Google\Cloud\AIPlatform\V1\CustomJobSpec;
use Google\Cloud\AIPlatform\V1\WorkerPoolSpec;
/**
* @param string $formattedParent The resource name of the Location to create the CustomJob in.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
* @param string $customJobDisplayName The display name of the CustomJob.
* The name can be up to 128 characters long and can consist of any UTF-8
* characters.
*/
function create_custom_job_sample(string $formattedParent, string $customJobDisplayName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$customJobJobSpecWorkerPoolSpecs = [new WorkerPoolSpec()];
$customJobJobSpec = (new CustomJobSpec())
->setWorkerPoolSpecs($customJobJobSpecWorkerPoolSpecs);
$customJob = (new CustomJob())
->setDisplayName($customJobDisplayName)
->setJobSpec($customJobJobSpec);
$request = (new CreateCustomJobRequest())
->setParent($formattedParent)
->setCustomJob($customJob);
// Call the API and handle any network failures.
try {
/** @var CustomJob $response */
$response = $jobServiceClient->createCustomJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
$customJobDisplayName = '[DISPLAY_NAME]';
create_custom_job_sample($formattedParent, $customJobDisplayName);
}
createDataLabelingJob
Creates a DataLabelingJob.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent of the DataLabelingJob.
Format: |
dataLabelingJob |
Google\Cloud\AIPlatform\V1\DataLabelingJob
Required. The DataLabelingJob to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\DataLabelingJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CreateDataLabelingJobRequest;
use Google\Cloud\AIPlatform\V1\DataLabelingJob;
use Google\Protobuf\Value;
/**
* @param string $formattedParent The parent of the DataLabelingJob.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
* @param string $dataLabelingJobDisplayName The user-defined name of the DataLabelingJob.
* The name can be up to 128 characters long and can consist of any UTF-8
* characters.
* Display name of a DataLabelingJob.
* @param string $formattedDataLabelingJobDatasetsElement Dataset resource names. Right now we only support labeling from a
* single Dataset. Format:
* `projects/{project}/locations/{location}/datasets/{dataset}`
* Please see {@see JobServiceClient::datasetName()} for help formatting this field.
* @param int $dataLabelingJobLabelerCount Number of labelers to work on each DataItem.
* @param string $dataLabelingJobInstructionUri The Google Cloud Storage location of the instruction pdf. This
* pdf is shared with labelers, and provides detailed description on how to
* label DataItems in Datasets.
* @param string $dataLabelingJobInputsSchemaUri Points to a YAML file stored on Google Cloud Storage describing
* the config for a specific type of DataLabelingJob. The schema files that
* can be used here are found in the
* https://storage.googleapis.com/google-cloud-aiplatform bucket in the
* /schema/datalabelingjob/inputs/ folder.
*/
function create_data_labeling_job_sample(
string $formattedParent,
string $dataLabelingJobDisplayName,
string $formattedDataLabelingJobDatasetsElement,
int $dataLabelingJobLabelerCount,
string $dataLabelingJobInstructionUri,
string $dataLabelingJobInputsSchemaUri
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$formattedDataLabelingJobDatasets = [$formattedDataLabelingJobDatasetsElement,];
$dataLabelingJobInputs = new Value();
$dataLabelingJob = (new DataLabelingJob())
->setDisplayName($dataLabelingJobDisplayName)
->setDatasets($formattedDataLabelingJobDatasets)
->setLabelerCount($dataLabelingJobLabelerCount)
->setInstructionUri($dataLabelingJobInstructionUri)
->setInputsSchemaUri($dataLabelingJobInputsSchemaUri)
->setInputs($dataLabelingJobInputs);
$request = (new CreateDataLabelingJobRequest())
->setParent($formattedParent)
->setDataLabelingJob($dataLabelingJob);
// Call the API and handle any network failures.
try {
/** @var DataLabelingJob $response */
$response = $jobServiceClient->createDataLabelingJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
$dataLabelingJobDisplayName = '[DISPLAY_NAME]';
$formattedDataLabelingJobDatasetsElement = JobServiceClient::datasetName(
'[PROJECT]',
'[LOCATION]',
'[DATASET]'
);
$dataLabelingJobLabelerCount = 0;
$dataLabelingJobInstructionUri = '[INSTRUCTION_URI]';
$dataLabelingJobInputsSchemaUri = '[INPUTS_SCHEMA_URI]';
create_data_labeling_job_sample(
$formattedParent,
$dataLabelingJobDisplayName,
$formattedDataLabelingJobDatasetsElement,
$dataLabelingJobLabelerCount,
$dataLabelingJobInstructionUri,
$dataLabelingJobInputsSchemaUri
);
}
createHyperparameterTuningJob
Creates a HyperparameterTuningJob
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to create the
HyperparameterTuningJob in. Format:
|
hyperparameterTuningJob |
Google\Cloud\AIPlatform\V1\HyperparameterTuningJob
Required. The HyperparameterTuningJob to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\HyperparameterTuningJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CreateHyperparameterTuningJobRequest;
use Google\Cloud\AIPlatform\V1\CustomJobSpec;
use Google\Cloud\AIPlatform\V1\HyperparameterTuningJob;
use Google\Cloud\AIPlatform\V1\StudySpec;
use Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec;
use Google\Cloud\AIPlatform\V1\StudySpec\MetricSpec\GoalType;
use Google\Cloud\AIPlatform\V1\StudySpec\ParameterSpec;
use Google\Cloud\AIPlatform\V1\WorkerPoolSpec;
/**
* @param string $formattedParent The resource name of the Location to create the
* HyperparameterTuningJob in. Format:
* `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
* @param string $hyperparameterTuningJobDisplayName The display name of the HyperparameterTuningJob.
* The name can be up to 128 characters long and can consist of any UTF-8
* characters.
* @param string $hyperparameterTuningJobStudySpecMetricsMetricId The ID of the metric. Must not contain whitespaces and must be
* unique amongst all MetricSpecs.
* @param int $hyperparameterTuningJobStudySpecMetricsGoal The optimization goal of the metric.
* @param string $hyperparameterTuningJobStudySpecParametersParameterId The ID of the parameter. Must not contain whitespaces and must
* be unique amongst all ParameterSpecs.
* @param int $hyperparameterTuningJobMaxTrialCount The desired total number of Trials.
* @param int $hyperparameterTuningJobParallelTrialCount The desired number of Trials to run in parallel.
*/
function create_hyperparameter_tuning_job_sample(
string $formattedParent,
string $hyperparameterTuningJobDisplayName,
string $hyperparameterTuningJobStudySpecMetricsMetricId,
int $hyperparameterTuningJobStudySpecMetricsGoal,
string $hyperparameterTuningJobStudySpecParametersParameterId,
int $hyperparameterTuningJobMaxTrialCount,
int $hyperparameterTuningJobParallelTrialCount
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$metricSpec = (new MetricSpec())
->setMetricId($hyperparameterTuningJobStudySpecMetricsMetricId)
->setGoal($hyperparameterTuningJobStudySpecMetricsGoal);
$hyperparameterTuningJobStudySpecMetrics = [$metricSpec,];
$parameterSpec = (new ParameterSpec())
->setParameterId($hyperparameterTuningJobStudySpecParametersParameterId);
$hyperparameterTuningJobStudySpecParameters = [$parameterSpec,];
$hyperparameterTuningJobStudySpec = (new StudySpec())
->setMetrics($hyperparameterTuningJobStudySpecMetrics)
->setParameters($hyperparameterTuningJobStudySpecParameters);
$hyperparameterTuningJobTrialJobSpecWorkerPoolSpecs = [new WorkerPoolSpec()];
$hyperparameterTuningJobTrialJobSpec = (new CustomJobSpec())
->setWorkerPoolSpecs($hyperparameterTuningJobTrialJobSpecWorkerPoolSpecs);
$hyperparameterTuningJob = (new HyperparameterTuningJob())
->setDisplayName($hyperparameterTuningJobDisplayName)
->setStudySpec($hyperparameterTuningJobStudySpec)
->setMaxTrialCount($hyperparameterTuningJobMaxTrialCount)
->setParallelTrialCount($hyperparameterTuningJobParallelTrialCount)
->setTrialJobSpec($hyperparameterTuningJobTrialJobSpec);
$request = (new CreateHyperparameterTuningJobRequest())
->setParent($formattedParent)
->setHyperparameterTuningJob($hyperparameterTuningJob);
// Call the API and handle any network failures.
try {
/** @var HyperparameterTuningJob $response */
$response = $jobServiceClient->createHyperparameterTuningJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
$hyperparameterTuningJobDisplayName = '[DISPLAY_NAME]';
$hyperparameterTuningJobStudySpecMetricsMetricId = '[METRIC_ID]';
$hyperparameterTuningJobStudySpecMetricsGoal = GoalType::GOAL_TYPE_UNSPECIFIED;
$hyperparameterTuningJobStudySpecParametersParameterId = '[PARAMETER_ID]';
$hyperparameterTuningJobMaxTrialCount = 0;
$hyperparameterTuningJobParallelTrialCount = 0;
create_hyperparameter_tuning_job_sample(
$formattedParent,
$hyperparameterTuningJobDisplayName,
$hyperparameterTuningJobStudySpecMetricsMetricId,
$hyperparameterTuningJobStudySpecMetricsGoal,
$hyperparameterTuningJobStudySpecParametersParameterId,
$hyperparameterTuningJobMaxTrialCount,
$hyperparameterTuningJobParallelTrialCount
);
}
createModelDeploymentMonitoringJob
Creates a ModelDeploymentMonitoringJob. It will run periodically on a configured interval.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent of the ModelDeploymentMonitoringJob.
Format: |
modelDeploymentMonitoringJob |
Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob
Required. The ModelDeploymentMonitoringJob to create |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CreateModelDeploymentMonitoringJobRequest;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringObjectiveConfig;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringScheduleConfig;
use Google\Cloud\AIPlatform\V1\SamplingStrategy;
use Google\Protobuf\Duration;
/**
* @param string $formattedParent The parent of the ModelDeploymentMonitoringJob.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
* @param string $modelDeploymentMonitoringJobDisplayName The user-defined name of the ModelDeploymentMonitoringJob.
* The name can be up to 128 characters long and can consist of any UTF-8
* characters.
* Display name of a ModelDeploymentMonitoringJob.
* @param string $formattedModelDeploymentMonitoringJobEndpoint Endpoint resource name.
* Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
* Please see {@see JobServiceClient::endpointName()} for help formatting this field.
*/
function create_model_deployment_monitoring_job_sample(
string $formattedParent,
string $modelDeploymentMonitoringJobDisplayName,
string $formattedModelDeploymentMonitoringJobEndpoint
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = [
new ModelDeploymentMonitoringObjectiveConfig()
];
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration();
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = (new ModelDeploymentMonitoringScheduleConfig())
->setMonitorInterval(
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfigMonitorInterval
);
$modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy();
$modelDeploymentMonitoringJob = (new ModelDeploymentMonitoringJob())
->setDisplayName($modelDeploymentMonitoringJobDisplayName)
->setEndpoint($formattedModelDeploymentMonitoringJobEndpoint)
->setModelDeploymentMonitoringObjectiveConfigs(
$modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs
)
->setModelDeploymentMonitoringScheduleConfig(
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig
)
->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy);
$request = (new CreateModelDeploymentMonitoringJobRequest())
->setParent($formattedParent)
->setModelDeploymentMonitoringJob($modelDeploymentMonitoringJob);
// Call the API and handle any network failures.
try {
/** @var ModelDeploymentMonitoringJob $response */
$response = $jobServiceClient->createModelDeploymentMonitoringJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
$modelDeploymentMonitoringJobDisplayName = '[DISPLAY_NAME]';
$formattedModelDeploymentMonitoringJobEndpoint = JobServiceClient::endpointName(
'[PROJECT]',
'[LOCATION]',
'[ENDPOINT]'
);
create_model_deployment_monitoring_job_sample(
$formattedParent,
$modelDeploymentMonitoringJobDisplayName,
$formattedModelDeploymentMonitoringJobEndpoint
);
}
createNasJob
Creates a NasJob
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to create the NasJob in.
Format: |
nasJob |
Google\Cloud\AIPlatform\V1\NasJob
Required. The NasJob to create. |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\NasJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CreateNasJobRequest;
use Google\Cloud\AIPlatform\V1\NasJob;
use Google\Cloud\AIPlatform\V1\NasJobSpec;
/**
* @param string $formattedParent The resource name of the Location to create the NasJob in.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
* @param string $nasJobDisplayName The display name of the NasJob.
* The name can be up to 128 characters long and can consist of any UTF-8
* characters.
*/
function create_nas_job_sample(string $formattedParent, string $nasJobDisplayName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$nasJobNasJobSpec = new NasJobSpec();
$nasJob = (new NasJob())
->setDisplayName($nasJobDisplayName)
->setNasJobSpec($nasJobNasJobSpec);
$request = (new CreateNasJobRequest())
->setParent($formattedParent)
->setNasJob($nasJob);
// Call the API and handle any network failures.
try {
/** @var NasJob $response */
$response = $jobServiceClient->createNasJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
$nasJobDisplayName = '[DISPLAY_NAME]';
create_nas_job_sample($formattedParent, $nasJobDisplayName);
}
deleteBatchPredictionJob
Deletes a BatchPredictionJob. Can only be called on jobs that already finished.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the BatchPredictionJob resource to be deleted.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteBatchPredictionJobRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the BatchPredictionJob resource to be deleted.
* Format:
* `projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}`
* Please see {@see JobServiceClient::batchPredictionJobName()} for help formatting this field.
*/
function delete_batch_prediction_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new DeleteBatchPredictionJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->deleteBatchPredictionJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::batchPredictionJobName(
'[PROJECT]',
'[LOCATION]',
'[BATCH_PREDICTION_JOB]'
);
delete_batch_prediction_job_sample($formattedName);
}
deleteCustomJob
Deletes a CustomJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the CustomJob resource to be deleted.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteCustomJobRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the CustomJob resource to be deleted.
* Format:
* `projects/{project}/locations/{location}/customJobs/{custom_job}`
* Please see {@see JobServiceClient::customJobName()} for help formatting this field.
*/
function delete_custom_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new DeleteCustomJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->deleteCustomJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]');
delete_custom_job_sample($formattedName);
}
deleteDataLabelingJob
Deletes a DataLabelingJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the DataLabelingJob to be deleted.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteDataLabelingJobRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the DataLabelingJob to be deleted.
* Format:
* `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}`
* Please see {@see JobServiceClient::dataLabelingJobName()} for help formatting this field.
*/
function delete_data_labeling_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new DeleteDataLabelingJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->deleteDataLabelingJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::dataLabelingJobName(
'[PROJECT]',
'[LOCATION]',
'[DATA_LABELING_JOB]'
);
delete_data_labeling_job_sample($formattedName);
}
deleteHyperparameterTuningJob
Deletes a HyperparameterTuningJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the HyperparameterTuningJob resource to be deleted.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteHyperparameterTuningJobRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the HyperparameterTuningJob resource to be deleted.
* Format:
* `projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}`
* Please see {@see JobServiceClient::hyperparameterTuningJobName()} for help formatting this field.
*/
function delete_hyperparameter_tuning_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new DeleteHyperparameterTuningJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->deleteHyperparameterTuningJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::hyperparameterTuningJobName(
'[PROJECT]',
'[LOCATION]',
'[HYPERPARAMETER_TUNING_JOB]'
);
delete_hyperparameter_tuning_job_sample($formattedName);
}
deleteModelDeploymentMonitoringJob
Deletes a ModelDeploymentMonitoringJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name of the model monitoring job to delete.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteModelDeploymentMonitoringJobRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The resource name of the model monitoring job to delete.
* Format:
* `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}`
* Please see {@see JobServiceClient::modelDeploymentMonitoringJobName()} for help formatting this field.
*/
function delete_model_deployment_monitoring_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new DeleteModelDeploymentMonitoringJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->deleteModelDeploymentMonitoringJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::modelDeploymentMonitoringJobName(
'[PROJECT]',
'[LOCATION]',
'[MODEL_DEPLOYMENT_MONITORING_JOB]'
);
delete_model_deployment_monitoring_job_sample($formattedName);
}
deleteNasJob
Deletes a NasJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the NasJob resource to be deleted.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DeleteNasJobRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the NasJob resource to be deleted.
* Format:
* `projects/{project}/locations/{location}/nasJobs/{nas_job}`
* Please see {@see JobServiceClient::nasJobName()} for help formatting this field.
*/
function delete_nas_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new DeleteNasJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->deleteNasJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
printf('Operation completed successfully.' . PHP_EOL);
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]');
delete_nas_job_sample($formattedName);
}
getBatchPredictionJob
Gets a BatchPredictionJob
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the BatchPredictionJob resource.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\BatchPredictionJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\BatchPredictionJob;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\GetBatchPredictionJobRequest;
/**
* @param string $formattedName The name of the BatchPredictionJob resource.
* Format:
* `projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}`
* Please see {@see JobServiceClient::batchPredictionJobName()} for help formatting this field.
*/
function get_batch_prediction_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetBatchPredictionJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var BatchPredictionJob $response */
$response = $jobServiceClient->getBatchPredictionJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::batchPredictionJobName(
'[PROJECT]',
'[LOCATION]',
'[BATCH_PREDICTION_JOB]'
);
get_batch_prediction_job_sample($formattedName);
}
getCustomJob
Gets a CustomJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the CustomJob resource.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\CustomJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CustomJob;
use Google\Cloud\AIPlatform\V1\GetCustomJobRequest;
/**
* @param string $formattedName The name of the CustomJob resource.
* Format:
* `projects/{project}/locations/{location}/customJobs/{custom_job}`
* Please see {@see JobServiceClient::customJobName()} for help formatting this field.
*/
function get_custom_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetCustomJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var CustomJob $response */
$response = $jobServiceClient->getCustomJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::customJobName('[PROJECT]', '[LOCATION]', '[CUSTOM_JOB]');
get_custom_job_sample($formattedName);
}
getDataLabelingJob
Gets a DataLabelingJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the DataLabelingJob.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\DataLabelingJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DataLabelingJob;
use Google\Cloud\AIPlatform\V1\GetDataLabelingJobRequest;
/**
* @param string $formattedName The name of the DataLabelingJob.
* Format:
* `projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}`
* Please see {@see JobServiceClient::dataLabelingJobName()} for help formatting this field.
*/
function get_data_labeling_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetDataLabelingJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var DataLabelingJob $response */
$response = $jobServiceClient->getDataLabelingJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::dataLabelingJobName(
'[PROJECT]',
'[LOCATION]',
'[DATA_LABELING_JOB]'
);
get_data_labeling_job_sample($formattedName);
}
getHyperparameterTuningJob
Gets a HyperparameterTuningJob
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the HyperparameterTuningJob resource.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\HyperparameterTuningJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\GetHyperparameterTuningJobRequest;
use Google\Cloud\AIPlatform\V1\HyperparameterTuningJob;
/**
* @param string $formattedName The name of the HyperparameterTuningJob resource.
* Format:
* `projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}`
* Please see {@see JobServiceClient::hyperparameterTuningJobName()} for help formatting this field.
*/
function get_hyperparameter_tuning_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetHyperparameterTuningJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var HyperparameterTuningJob $response */
$response = $jobServiceClient->getHyperparameterTuningJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::hyperparameterTuningJobName(
'[PROJECT]',
'[LOCATION]',
'[HYPERPARAMETER_TUNING_JOB]'
);
get_hyperparameter_tuning_job_sample($formattedName);
}
getModelDeploymentMonitoringJob
Gets a ModelDeploymentMonitoringJob.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name of the ModelDeploymentMonitoringJob.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\GetModelDeploymentMonitoringJobRequest;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob;
/**
* @param string $formattedName The resource name of the ModelDeploymentMonitoringJob.
* Format:
* `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}`
* Please see {@see JobServiceClient::modelDeploymentMonitoringJobName()} for help formatting this field.
*/
function get_model_deployment_monitoring_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetModelDeploymentMonitoringJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ModelDeploymentMonitoringJob $response */
$response = $jobServiceClient->getModelDeploymentMonitoringJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::modelDeploymentMonitoringJobName(
'[PROJECT]',
'[LOCATION]',
'[MODEL_DEPLOYMENT_MONITORING_JOB]'
);
get_model_deployment_monitoring_job_sample($formattedName);
}
getNasJob
Gets a NasJob
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the NasJob resource.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\NasJob |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\GetNasJobRequest;
use Google\Cloud\AIPlatform\V1\NasJob;
/**
* @param string $formattedName The name of the NasJob resource.
* Format:
* `projects/{project}/locations/{location}/nasJobs/{nas_job}`
* Please see {@see JobServiceClient::nasJobName()} for help formatting this field.
*/
function get_nas_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetNasJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var NasJob $response */
$response = $jobServiceClient->getNasJob($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]');
get_nas_job_sample($formattedName);
}
getNasTrialDetail
Gets a NasTrialDetail.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The name of the NasTrialDetail resource.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\AIPlatform\V1\NasTrialDetail |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\GetNasTrialDetailRequest;
use Google\Cloud\AIPlatform\V1\NasTrialDetail;
/**
* @param string $formattedName The name of the NasTrialDetail resource.
* Format:
* `projects/{project}/locations/{location}/nasJobs/{nas_job}/nasTrialDetails/{nas_trial_detail}`
* Please see {@see JobServiceClient::nasTrialDetailName()} for help formatting this field.
*/
function get_nas_trial_detail_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetNasTrialDetailRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var NasTrialDetail $response */
$response = $jobServiceClient->getNasTrialDetail($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::nasTrialDetailName(
'[PROJECT]',
'[LOCATION]',
'[NAS_JOB]',
'[NAS_TRIAL_DETAIL]'
);
get_nas_trial_detail_sample($formattedName);
}
listBatchPredictionJobs
Lists BatchPredictionJobs in a Location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to list the BatchPredictionJobs
from. Format: |
optionalArgs |
array
Optional. |
↳ filter |
string
The standard list filter. Supported fields: * |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
Mask specifying which fields to read. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\BatchPredictionJob;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ListBatchPredictionJobsRequest;
/**
* @param string $formattedParent The resource name of the Location to list the BatchPredictionJobs
* from. Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
*/
function list_batch_prediction_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListBatchPredictionJobsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listBatchPredictionJobs($request);
/** @var BatchPredictionJob $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
list_batch_prediction_jobs_sample($formattedParent);
}
listCustomJobs
Lists CustomJobs in a Location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to list the CustomJobs from.
Format: |
optionalArgs |
array
Optional. |
↳ filter |
string
The standard list filter. Supported fields: * |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
Mask specifying which fields to read. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\CustomJob;
use Google\Cloud\AIPlatform\V1\ListCustomJobsRequest;
/**
* @param string $formattedParent The resource name of the Location to list the CustomJobs from.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
*/
function list_custom_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListCustomJobsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listCustomJobs($request);
/** @var CustomJob $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
list_custom_jobs_sample($formattedParent);
}
listDataLabelingJobs
Lists DataLabelingJobs in a Location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent of the DataLabelingJob.
Format: |
optionalArgs |
array
Optional. |
↳ filter |
string
The standard list filter. Supported fields: * |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
Mask specifying which fields to read. FieldMask represents a set of symbolic field paths. For example, the mask can be |
↳ orderBy |
string
A comma-separated list of fields to order by, sorted in ascending order by default. Use |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\DataLabelingJob;
use Google\Cloud\AIPlatform\V1\ListDataLabelingJobsRequest;
/**
* @param string $formattedParent The parent of the DataLabelingJob.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
*/
function list_data_labeling_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListDataLabelingJobsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listDataLabelingJobs($request);
/** @var DataLabelingJob $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
list_data_labeling_jobs_sample($formattedParent);
}
listHyperparameterTuningJobs
Lists HyperparameterTuningJobs in a Location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to list the
HyperparameterTuningJobs from. Format:
|
optionalArgs |
array
Optional. |
↳ filter |
string
The standard list filter. Supported fields: * |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
Mask specifying which fields to read. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\HyperparameterTuningJob;
use Google\Cloud\AIPlatform\V1\ListHyperparameterTuningJobsRequest;
/**
* @param string $formattedParent The resource name of the Location to list the
* HyperparameterTuningJobs from. Format:
* `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
*/
function list_hyperparameter_tuning_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListHyperparameterTuningJobsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listHyperparameterTuningJobs($request);
/** @var HyperparameterTuningJob $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
list_hyperparameter_tuning_jobs_sample($formattedParent);
}
listModelDeploymentMonitoringJobs
Lists ModelDeploymentMonitoringJobs in a Location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The parent of the ModelDeploymentMonitoringJob.
Format: |
optionalArgs |
array
Optional. |
↳ filter |
string
The standard list filter. Supported fields: * |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
Mask specifying which fields to read |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ListModelDeploymentMonitoringJobsRequest;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob;
/**
* @param string $formattedParent The parent of the ModelDeploymentMonitoringJob.
* Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
*/
function list_model_deployment_monitoring_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListModelDeploymentMonitoringJobsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listModelDeploymentMonitoringJobs($request);
/** @var ModelDeploymentMonitoringJob $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
list_model_deployment_monitoring_jobs_sample($formattedParent);
}
listNasJobs
Lists NasJobs in a Location.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The resource name of the Location to list the NasJobs
from. Format: |
optionalArgs |
array
Optional. |
↳ filter |
string
The standard list filter. Supported fields: * |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ readMask |
FieldMask
Mask specifying which fields to read. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ListNasJobsRequest;
use Google\Cloud\AIPlatform\V1\NasJob;
/**
* @param string $formattedParent The resource name of the Location to list the NasJobs
* from. Format: `projects/{project}/locations/{location}`
* Please see {@see JobServiceClient::locationName()} for help formatting this field.
*/
function list_nas_jobs_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListNasJobsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listNasJobs($request);
/** @var NasJob $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::locationName('[PROJECT]', '[LOCATION]');
list_nas_jobs_sample($formattedParent);
}
listNasTrialDetails
List top NasTrialDetails of a NasJob.
Parameters | |
---|---|
Name | Description |
parent |
string
Required. The name of the NasJob resource.
Format:
|
optionalArgs |
array
Optional. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ListNasTrialDetailsRequest;
use Google\Cloud\AIPlatform\V1\NasTrialDetail;
/**
* @param string $formattedParent The name of the NasJob resource.
* Format:
* `projects/{project}/locations/{location}/nasJobs/{nas_job}`
* Please see {@see JobServiceClient::nasJobName()} for help formatting this field.
*/
function list_nas_trial_details_sample(string $formattedParent): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ListNasTrialDetailsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listNasTrialDetails($request);
/** @var NasTrialDetail $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = JobServiceClient::nasJobName('[PROJECT]', '[LOCATION]', '[NAS_JOB]');
list_nas_trial_details_sample($formattedParent);
}
pauseModelDeploymentMonitoringJob
Pauses a ModelDeploymentMonitoringJob. If the job is running, the server makes a best effort to cancel the job. Will mark ModelDeploymentMonitoringJob.state to 'PAUSED'.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name of the ModelDeploymentMonitoringJob to pause.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\PauseModelDeploymentMonitoringJobRequest;
/**
* @param string $formattedName The resource name of the ModelDeploymentMonitoringJob to pause.
* Format:
* `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}`
* Please see {@see JobServiceClient::modelDeploymentMonitoringJobName()} for help formatting this field.
*/
function pause_model_deployment_monitoring_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new PauseModelDeploymentMonitoringJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->pauseModelDeploymentMonitoringJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::modelDeploymentMonitoringJobName(
'[PROJECT]',
'[LOCATION]',
'[MODEL_DEPLOYMENT_MONITORING_JOB]'
);
pause_model_deployment_monitoring_job_sample($formattedName);
}
resumeModelDeploymentMonitoringJob
Resumes a paused ModelDeploymentMonitoringJob. It will start to run from next scheduled time. A deleted ModelDeploymentMonitoringJob can't be resumed.
Parameters | |
---|---|
Name | Description |
name |
string
Required. The resource name of the ModelDeploymentMonitoringJob to resume.
Format:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ResumeModelDeploymentMonitoringJobRequest;
/**
* @param string $formattedName The resource name of the ModelDeploymentMonitoringJob to resume.
* Format:
* `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}`
* Please see {@see JobServiceClient::modelDeploymentMonitoringJobName()} for help formatting this field.
*/
function resume_model_deployment_monitoring_job_sample(string $formattedName): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new ResumeModelDeploymentMonitoringJobRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$jobServiceClient->resumeModelDeploymentMonitoringJob($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = JobServiceClient::modelDeploymentMonitoringJobName(
'[PROJECT]',
'[LOCATION]',
'[MODEL_DEPLOYMENT_MONITORING_JOB]'
);
resume_model_deployment_monitoring_job_sample($formattedName);
}
searchModelDeploymentMonitoringStatsAnomalies
Searches Model Monitoring Statistics generated within a given time window.
Parameters | |
---|---|
Name | Description |
modelDeploymentMonitoringJob |
string
Required. ModelDeploymentMonitoring Job resource name.
Format:
|
deployedModelId |
string
Required. The DeployedModel ID of the [ModelDeploymentMonitoringObjectiveConfig.deployed_model_id]. |
objectives |
array<Google\Cloud\AIPlatform\V1\SearchModelDeploymentMonitoringStatsAnomaliesRequest\StatsAnomaliesObjective>
Required. Objectives of the stats to retrieve. |
optionalArgs |
array
Optional. |
↳ featureDisplayName |
string
The feature display name. If specified, only return the stats belonging to this feature. Format: ModelMonitoringStatsAnomalies.FeatureHistoricStatsAnomalies.feature_display_name, example: "user_destination". |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ startTime |
Timestamp
The earliest timestamp of stats being generated. If not set, indicates fetching stats till the earliest possible one. |
↳ endTime |
Timestamp
The latest timestamp of stats being generated. If not set, indicates feching stats till the latest possible one. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ModelMonitoringStatsAnomalies;
use Google\Cloud\AIPlatform\V1\SearchModelDeploymentMonitoringStatsAnomaliesRequest;
use Google\Cloud\AIPlatform\V1\SearchModelDeploymentMonitoringStatsAnomaliesRequest\StatsAnomaliesObjective;
/**
* @param string $formattedModelDeploymentMonitoringJob ModelDeploymentMonitoring Job resource name.
* Format:
* `projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}`
* Please see {@see JobServiceClient::modelDeploymentMonitoringJobName()} for help formatting this field.
* @param string $deployedModelId The DeployedModel ID of the
* [ModelDeploymentMonitoringObjectiveConfig.deployed_model_id].
*/
function search_model_deployment_monitoring_stats_anomalies_sample(
string $formattedModelDeploymentMonitoringJob,
string $deployedModelId
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$objectives = [new StatsAnomaliesObjective()];
$request = (new SearchModelDeploymentMonitoringStatsAnomaliesRequest())
->setModelDeploymentMonitoringJob($formattedModelDeploymentMonitoringJob)
->setDeployedModelId($deployedModelId)
->setObjectives($objectives);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->searchModelDeploymentMonitoringStatsAnomalies($request);
/** @var ModelMonitoringStatsAnomalies $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedModelDeploymentMonitoringJob = JobServiceClient::modelDeploymentMonitoringJobName(
'[PROJECT]',
'[LOCATION]',
'[MODEL_DEPLOYMENT_MONITORING_JOB]'
);
$deployedModelId = '[DEPLOYED_MODEL_ID]';
search_model_deployment_monitoring_stats_anomalies_sample(
$formattedModelDeploymentMonitoringJob,
$deployedModelId
);
}
updateModelDeploymentMonitoringJob
Updates a ModelDeploymentMonitoringJob.
Parameters | |
---|---|
Name | Description |
modelDeploymentMonitoringJob |
Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob
Required. The model monitoring configuration which replaces the resource on the server. |
updateMask |
Google\Protobuf\FieldMask
Required. The update mask is used to specify the fields to be overwritten
in the ModelDeploymentMonitoringJob resource by the update. The fields
specified in the update_mask are relative to the resource, not the full
request. A field will be overwritten if it is in the mask. If the user does
not provide a mask then only the non-empty fields present in the request
will be overwritten. Set the update_mask to Updatable fields:
|
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringJob;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringObjectiveConfig;
use Google\Cloud\AIPlatform\V1\ModelDeploymentMonitoringScheduleConfig;
use Google\Cloud\AIPlatform\V1\SamplingStrategy;
use Google\Cloud\AIPlatform\V1\UpdateModelDeploymentMonitoringJobRequest;
use Google\Protobuf\Duration;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $modelDeploymentMonitoringJobDisplayName The user-defined name of the ModelDeploymentMonitoringJob.
* The name can be up to 128 characters long and can consist of any UTF-8
* characters.
* Display name of a ModelDeploymentMonitoringJob.
* @param string $formattedModelDeploymentMonitoringJobEndpoint Endpoint resource name.
* Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`
* Please see {@see JobServiceClient::endpointName()} for help formatting this field.
*/
function update_model_deployment_monitoring_job_sample(
string $modelDeploymentMonitoringJobDisplayName,
string $formattedModelDeploymentMonitoringJobEndpoint
): void {
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs = [
new ModelDeploymentMonitoringObjectiveConfig()
];
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfigMonitorInterval = new Duration();
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig = (new ModelDeploymentMonitoringScheduleConfig())
->setMonitorInterval(
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfigMonitorInterval
);
$modelDeploymentMonitoringJobLoggingSamplingStrategy = new SamplingStrategy();
$modelDeploymentMonitoringJob = (new ModelDeploymentMonitoringJob())
->setDisplayName($modelDeploymentMonitoringJobDisplayName)
->setEndpoint($formattedModelDeploymentMonitoringJobEndpoint)
->setModelDeploymentMonitoringObjectiveConfigs(
$modelDeploymentMonitoringJobModelDeploymentMonitoringObjectiveConfigs
)
->setModelDeploymentMonitoringScheduleConfig(
$modelDeploymentMonitoringJobModelDeploymentMonitoringScheduleConfig
)
->setLoggingSamplingStrategy($modelDeploymentMonitoringJobLoggingSamplingStrategy);
$updateMask = new FieldMask();
$request = (new UpdateModelDeploymentMonitoringJobRequest())
->setModelDeploymentMonitoringJob($modelDeploymentMonitoringJob)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $jobServiceClient->updateModelDeploymentMonitoringJob($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var ModelDeploymentMonitoringJob $result */
$result = $response->getResult();
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
} else {
/** @var Status $error */
$error = $response->getError();
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$modelDeploymentMonitoringJobDisplayName = '[DISPLAY_NAME]';
$formattedModelDeploymentMonitoringJobEndpoint = JobServiceClient::endpointName(
'[PROJECT]',
'[LOCATION]',
'[ENDPOINT]'
);
update_model_deployment_monitoring_job_sample(
$modelDeploymentMonitoringJobDisplayName,
$formattedModelDeploymentMonitoringJobEndpoint
);
}
getLocation
Gets information about a location.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
Resource name for the location. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
/**
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function get_location_sample(): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $jobServiceClient->getLocation($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
listLocations
Lists information about the supported locations for this service.
Parameters | |
---|---|
Name | Description |
optionalArgs |
array
Optional. |
↳ name |
string
The resource that owns the locations collection, if applicable. |
↳ filter |
string
The standard list filter. |
↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
/**
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function list_locations_sample(): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $jobServiceClient->listLocations($request);
/** @var Location $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
getIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
optionalArgs |
array
Optional. |
↳ options |
GetPolicyOptions
OPTIONAL: A |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
/**
* @param string $resource REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
function get_iam_policy_sample(string $resource): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $jobServiceClient->getIamPolicy($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
get_iam_policy_sample($resource);
}
setIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy |
Google\Cloud\Iam\V1\Policy
REQUIRED: The complete policy to be applied to the |
optionalArgs |
array
Optional. |
↳ updateMask |
FieldMask
OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
/**
* @param string $resource REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
function set_iam_policy_sample(string $resource): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$policy = new Policy();
$request = (new SetIamPolicyRequest())
->setResource($resource)
->setPolicy($policy);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $jobServiceClient->setIamPolicy($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
set_iam_policy_sample($resource);
}
testIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
Parameters | |
---|---|
Name | Description |
resource |
string
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions |
string[]
The set of permissions to check for the |
optionalArgs |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\AIPlatform\V1\Client\JobServiceClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
/**
* @param string $resource REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
* @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
*/
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
// Create a client.
$jobServiceClient = new JobServiceClient();
// Prepare the request message.
$permissions = [$permissionsElement,];
$request = (new TestIamPermissionsRequest())
->setResource($resource)
->setPermissions($permissions);
// Call the API and handle any network failures.
try {
/** @var TestIamPermissionsResponse $response */
$response = $jobServiceClient->testIamPermissions($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample 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,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
$permissionsElement = '[PERMISSIONS]';
test_iam_permissions_sample($resource, $permissionsElement);
}
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
Returns | |
---|---|
Type | Description |
Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
Parameters | |
---|---|
Name | Description |
operationName |
string
The name of the long running operation |
methodName |
string
The name of the method used to start the operation |
Returns | |
---|---|
Type | Description |
Google\ApiCore\OperationResponse |
static::batchPredictionJobName
Formats a string containing the fully-qualified path to represent a batch_prediction_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
batchPredictionJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted batch_prediction_job resource. |
static::contextName
Formats a string containing the fully-qualified path to represent a context resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
metadataStore |
string
|
context |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted context resource. |
static::customJobName
Formats a string containing the fully-qualified path to represent a custom_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
customJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted custom_job resource. |
static::dataLabelingJobName
Formats a string containing the fully-qualified path to represent a data_labeling_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataLabelingJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted data_labeling_job resource. |
static::datasetName
Formats a string containing the fully-qualified path to represent a dataset resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
dataset |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted dataset resource. |
static::endpointName
Formats a string containing the fully-qualified path to represent a endpoint resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
endpoint |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted endpoint resource. |
static::hyperparameterTuningJobName
Formats a string containing the fully-qualified path to represent a hyperparameter_tuning_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
hyperparameterTuningJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted hyperparameter_tuning_job resource. |
static::locationName
Formats a string containing the fully-qualified path to represent a location resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted location resource. |
static::modelName
Formats a string containing the fully-qualified path to represent a model resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
model |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted model resource. |
static::modelDeploymentMonitoringJobName
Formats a string containing the fully-qualified path to represent a model_deployment_monitoring_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
modelDeploymentMonitoringJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted model_deployment_monitoring_job resource. |
static::nasJobName
Formats a string containing the fully-qualified path to represent a nas_job resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
nasJob |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted nas_job resource. |
static::nasTrialDetailName
Formats a string containing the fully-qualified path to represent a nas_trial_detail resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
nasJob |
string
|
nasTrialDetail |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted nas_trial_detail resource. |
static::networkName
Formats a string containing the fully-qualified path to represent a network resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
network |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted network resource. |
static::notificationChannelName
Formats a string containing the fully-qualified path to represent a notification_channel resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
notificationChannel |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted notification_channel resource. |
static::projectLocationEndpointName
Formats a string containing the fully-qualified path to represent a project_location_endpoint resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
endpoint |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_location_endpoint resource. |
static::projectLocationPublisherModelName
Formats a string containing the fully-qualified path to represent a project_location_publisher_model resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
publisher |
string
|
model |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted project_location_publisher_model resource. |
static::tensorboardName
Formats a string containing the fully-qualified path to represent a tensorboard resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
tensorboard |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted tensorboard resource. |
static::trialName
Formats a string containing the fully-qualified path to represent a trial resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
study |
string
|
trial |
string
|
Returns | |
---|---|
Type | Description |
string | The formatted trial resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- batchPredictionJob: projects/{project}/locations/{location}/batchPredictionJobs/{batch_prediction_job}
- context: projects/{project}/locations/{location}/metadataStores/{metadata_store}/contexts/{context}
- customJob: projects/{project}/locations/{location}/customJobs/{custom_job}
- dataLabelingJob: projects/{project}/locations/{location}/dataLabelingJobs/{data_labeling_job}
- dataset: projects/{project}/locations/{location}/datasets/{dataset}
- endpoint: projects/{project}/locations/{location}/endpoints/{endpoint}
- hyperparameterTuningJob: projects/{project}/locations/{location}/hyperparameterTuningJobs/{hyperparameter_tuning_job}
- location: projects/{project}/locations/{location}
- model: projects/{project}/locations/{location}/models/{model}
- modelDeploymentMonitoringJob: projects/{project}/locations/{location}/modelDeploymentMonitoringJobs/{model_deployment_monitoring_job}
- nasJob: projects/{project}/locations/{location}/nasJobs/{nas_job}
- nasTrialDetail: projects/{project}/locations/{location}/nasJobs/{nas_job}/nasTrialDetails/{nas_trial_detail}
- network: projects/{project}/global/networks/{network}
- notificationChannel: projects/{project}/notificationChannels/{notification_channel}
- projectLocationEndpoint: projects/{project}/locations/{location}/endpoints/{endpoint}
- projectLocationPublisherModel: projects/{project}/locations/{location}/publishers/{publisher}/models/{model}
- tensorboard: projects/{project}/locations/{location}/tensorboards/{tensorboard}
- trial: projects/{project}/locations/{location}/studies/{study}/trials/{trial}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array | An associative array from name component IDs to component values. |
Constants
SERVICE_NAME
Value: 'google.cloud.aiplatform.v1.JobService'
The name of the service.
SERVICE_ADDRESS
Value: 'aiplatform.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.