Resource: BatchPredictionJob
A job that uses a  Model 
 
to produce predictions on multiple  input instances 
 
. If predictions for significant portion of the instances fail, the job may finish without attempting predictions for all remaining instances.
name 
 
  string 
 
Output only. Resource name of the BatchPredictionJob.
displayName 
 
  string 
 
Required. The user-defined name of this BatchPredictionJob.
model 
 
  string 
 
The name of the Model resource that produces the predictions via this job, must share the same ancestor Location. Starting this job has no impact on any existing deployments of the Model and their resources. Exactly one of model and unmanagedContainerModel must be set.
The model resource name may contain version id or version alias to specify the version.  Example: projects/{project}/locations/{location}/models/{model}@2 
or projects/{project}/locations/{location}/models/{model}@golden 
if no version is specified, the default version will be deployed.
The model resource could also be a publisher model.  Example: publishers/{publisher}/models/{model} 
or projects/{project}/locations/{location}/publishers/{publisher}/models/{model} 
modelVersionId 
 
  string 
 
Output only. The version id of the Model that produces the predictions via this job.
unmanagedContainerModel 
 
  object (  UnmanagedContainerModel 
 
) 
 
Contains model information necessary to perform batch prediction without requiring uploading to model registry. Exactly one of model and unmanagedContainerModel must be set.
inputConfig 
 
  object (  InputConfig 
 
) 
 
Required. Input configuration of the instances on which predictions are performed. The schema of any single instance may be specified via the  Model's 
 
  PredictSchemata's 
 
  instanceSchemaUri 
 
.
instanceConfig 
 
  object (  InstanceConfig 
 
) 
 
Configuration for how to convert batch prediction input instances to the prediction instances that are sent to the Model.
modelParameters 
 
  value (  Value 
 
format) 
 
The parameters that govern the predictions. The schema of the parameters may be specified via the  Model's 
 
  PredictSchemata's 
 
  parametersSchemaUri 
 
.
outputConfig 
 
  object (  OutputConfig 
 
) 
 
Required. The Configuration specifying where output predictions should be written. The schema of any single prediction may be specified as a concatenation of  Model's 
 
  PredictSchemata's 
 
  instanceSchemaUri 
 
and  predictionSchemaUri 
 
.
dedicatedResources 
 
  object (  BatchDedicatedResources 
 
) 
 
The config of resources used by the Model during the batch prediction. If the Model  supports 
 
DEDICATED_RESOURCES this config may be provided (and the job will use these resources), if the Model doesn't support AUTOMATIC_RESOURCES, this config must be provided.
serviceAccount 
 
  string 
 
The service account that the DeployedModel's container runs as. If not specified, a system generated one will be used, which has minimal permissions and the custom container, if used, may not have enough permission to access other Google Cloud resources.
Users deploying the Model must have the iam.serviceAccounts.actAs 
permission on this service account.
manualBatchTuningParameters 
 
  object (  ManualBatchTuningParameters 
 
) 
 
Immutable. Parameters configuring the batch behavior. Currently only applicable when  dedicatedResources 
 
are used (in other cases Vertex AI does the tuning itself).
generateExplanation 
 
  boolean 
 
Generate explanation with the batch prediction results.
When set to true 
, the batch prediction output changes based on the predictionsFormat 
field of the  BatchPredictionJob.output_config 
 
object:
-  bigquery: output includes a column namedexplanation. The value is a struct that conforms to theExplanationobject.
-  jsonl: The JSON objects on each line include an additional entry keyedexplanation. The value of the entry is a JSON object that conforms to theExplanationobject.
-  csv: Generating explanations for CSV format is not supported.
If this field is set to true, either the  Model.explanation_spec 
 
or  explanationSpec 
 
must be populated.
explanationSpec 
 
  object (  ExplanationSpec 
 
) 
 
Explanation configuration for this BatchPredictionJob. Can be specified only if  generateExplanation 
 
is set to true 
.
This value overrides the value of  Model.explanation_spec 
 
. All fields of  explanationSpec 
 
are optional in the request. If a field of the  explanationSpec 
 
object is not populated, the corresponding field of the  Model.explanation_spec 
 
object is inherited.
outputInfo 
 
  object (  OutputInfo 
 
) 
 
Output only. Information further describing the output of this job.
state 
 
  enum (  JobState 
 
) 
 
Output only. The detailed state of the job.
error 
 
  object (  Status 
 
) 
 
Output only. Only populated when the job's state is JOB_STATE_FAILED or JOB_STATE_CANCELLED.
partialFailures[] 
 
  object (  Status 
 
) 
 
Output only. Partial failures encountered. For example, single files that can't be read. This field never exceeds 20 entries. status details fields contain standard Google Cloud error details.
resourcesConsumed 
 
  object (  ResourcesConsumed 
 
) 
 
Output only. Information about resources that had been consumed by this job. Provided in real time at best effort basis, as well as a final value once the job completes.
Note: This field currently may be not populated for batch predictions that use AutoML Models.
completionStats 
 
  object (  CompletionStats 
 
) 
 
Output only. Statistics on completed and failed prediction instances.
createTime 
 
  string (  Timestamp 
 
format) 
 
Output only. time when the BatchPredictionJob was created.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" 
, "2014-10-02T15:01:23.045123456Z" 
or "2014-10-02T15:01:23+05:30" 
.
startTime 
 
  string (  Timestamp 
 
format) 
 
Output only. time when the BatchPredictionJob for the first time entered the JOB_STATE_RUNNING 
state.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" 
, "2014-10-02T15:01:23.045123456Z" 
or "2014-10-02T15:01:23+05:30" 
.
endTime 
 
  string (  Timestamp 
 
format) 
 
Output only. time when the BatchPredictionJob entered any of the following states: JOB_STATE_SUCCEEDED 
, JOB_STATE_FAILED 
, JOB_STATE_CANCELLED 
.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" 
, "2014-10-02T15:01:23.045123456Z" 
or "2014-10-02T15:01:23+05:30" 
.
updateTime 
 
  string (  Timestamp 
 
format) 
 
Output only. time when the BatchPredictionJob was most recently updated.
Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z" 
, "2014-10-02T15:01:23.045123456Z" 
or "2014-10-02T15:01:23+05:30" 
.
labels 
 
  map (key: string, value: string) 
 
The labels with user-defined metadata to organize BatchPredictionJobs.
label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed.
See https://goo.gl/xmQnxf for more information and examples of labels.
encryptionSpec 
 
  object (  EncryptionSpec 
 
) 
 
Customer-managed encryption key options for a BatchPredictionJob. If this is set, then all resources created by the BatchPredictionJob will be encrypted with the provided encryption key.
disableContainerLogging 
 
  boolean 
 
For custom-trained Models and AutoML Tabular Models, the container of the DeployedModel instances will send stderr 
and stdout 
streams to Cloud Logging by default. Please note that the logs incur cost, which are subject to Cloud Logging pricing 
.
user can disable container logging by setting this flag to true.
satisfiesPzs 
 
  boolean 
 
Output only. reserved for future use.
satisfiesPzi 
 
  boolean 
 
Output only. reserved for future use.
| JSON representation | 
|---|
| { "name" : string , "displayName" : string , "model" : string , "modelVersionId" : string , "unmanagedContainerModel" : { object ( | 
UnmanagedContainerModel
Contains model information necessary to perform batch prediction without requiring a full model import.
artifactUri 
 
  string 
 
The path to the directory containing the Model artifact and any of its supporting files.
predictSchemata 
 
  object (  PredictSchemata 
 
) 
 
Contains the schemata used in Model's predictions and explanations
containerSpec 
 
  object (  ModelContainerSpec 
 
) 
 
Input only. The specification of the container that is to be used when deploying this Model.
| JSON representation | 
|---|
| { "artifactUri" : string , "predictSchemata" : { object ( | 
InputConfig
Configures the input to  BatchPredictionJob 
 
. See  Model.supported_input_storage_formats 
 
for Model's supported input formats, and how instances should be expressed via any of them.
instancesFormat 
 
  string 
 
Required. The format in which instances are given, must be one of the  Model's 
 
  supportedInputStorageFormats 
 
.
source 
 
  Union type 
 
 source 
can be only one of the following:gcsSource 
 
  object (  GcsSource 
 
) 
 
The Cloud Storage location for the input instances.
bigquerySource 
 
  object (  BigQuerySource 
 
) 
 
The BigQuery location of the input table. The schema of the table should be in the format described by the given context OpenAPI Schema, if one is provided. The table may contain additional columns that are not described by the schema, and they will be ignored.
| JSON representation | 
|---|
| { "instancesFormat" : string , // source "gcsSource" : { object ( | 
InstanceConfig
Configuration defining how to transform batch prediction input instances to the instances that the Model accepts.
instanceType 
 
  string 
 
The format of the instance that the Model accepts. Vertex AI will convert compatible  batch prediction input instance formats 
 
to the specified format.
Supported values are:
-  object: Each input is converted to JSON object format.- For bigquery, each row is converted to an object.
- For jsonl, each line of the JSONL input must be an object.
- Does not apply to csv,file-list,tf-record, ortf-record-gzip.
 
- For 
-  array: Each input is converted to JSON array format.- For bigquery, each row is converted to an array. The order of columns is determined by the BigQuery column order, unlessincludedFieldsis populated.includedFieldsmust be populated for specifying field orders.
- For jsonl, if each line of the JSONL input is an object,includedFieldsmust be populated for specifying field orders.
- Does not apply to csv,file-list,tf-record, ortf-record-gzip.
 
- For 
If not specified, Vertex AI converts the batch prediction input as follows:
- For bigqueryandcsv, the behavior is the same asarray. The order of columns is the same as defined in the file or table, unlessincludedFieldsis populated.
- For jsonl, the prediction instance format is determined by each line of the input.
- For tf-record/tf-record-gzip, each record will be converted to an object in the format of{"b64": <value>}, where<value>is the Base64-encoded string of the content of the record.
- For file-list, each file in the list will be converted to an object in the format of{"b64": <value>}, where<value>is the Base64-encoded string of the content of the file.
keyField 
 
  string 
 
The name of the field that is considered as a key.
The values identified by the key field is not included in the transformed instances that is sent to the Model. This is similar to specifying this name of the field in  excludedFields 
 
. In addition, the batch prediction output will not include the instances. Instead the output will only include the value of the key field, in a field named key 
in the output:
- For jsonloutput format, the output will have akeyfield instead of theinstancefield.
- For csv/bigqueryoutput format, the output will have have akeycolumn instead of the instance feature columns.
The input must be JSONL with objects at each line, CSV, BigQuery or TfRecord.
includedFields[] 
 
  string 
 
Fields that will be included in the prediction instance that is sent to the Model.
If  instanceType 
 
is array 
, the order of field names in includedFields also determines the order of the values in the array.
When includedFields is populated,  excludedFields 
 
must be empty.
The input must be JSONL with objects at each line, BigQuery or TfRecord.
excludedFields[] 
 
  string 
 
Fields that will be excluded in the prediction instance that is sent to the Model.
Excluded will be attached to the batch prediction output if  keyField 
 
is not specified.
When excludedFields is populated,  includedFields 
 
must be empty.
The input must be JSONL with objects at each line, BigQuery or TfRecord.
| JSON representation | 
|---|
| { "instanceType" : string , "keyField" : string , "includedFields" : [ string ] , "excludedFields" : [ string ] } | 
OutputConfig
Configures the output of  BatchPredictionJob 
 
. See  Model.supported_output_storage_formats 
 
for supported output formats, and how predictions are expressed via any of them.
predictionsFormat 
 
  string 
 
Required. The format in which Vertex AI gives the predictions, must be one of the  Model's 
 
  supportedOutputStorageFormats 
 
.
destination 
 
  Union type 
 
 destination 
can be only one of the following:gcsDestination 
 
  object (  GcsDestination 
 
) 
 
The Cloud Storage location of the directory where the output is to be written to. In the given directory a new directory is created. Its name is prediction-<model-display-name>-<job-create-time> 
, where timestamp is in YYYY-MM-DDThh:mm:ss.sssZ ISO-8601 format. Inside of it files predictions_0001.<extension> 
, predictions_0002.<extension> 
, ..., predictions_N.<extension> 
are created where <extension> 
depends on chosen  predictionsFormat 
 
, and N may equal 0001 and depends on the total number of successfully predicted instances. If the Model has both  instance 
 
and  prediction 
 
schemata defined then each such file contains predictions as per the  predictionsFormat 
 
. If prediction for any instance failed (partially or completely), then an additional errors_0001.<extension> 
, errors_0002.<extension> 
,..., errors_N.<extension> 
files are created (N depends on total number of failed predictions). These files contain the failed instances, as per their schema, followed by an additional error 
field which as value has  google.rpc.Status 
 
containing only code 
and message 
fields.
bigqueryDestination 
 
  object (  BigQueryDestination 
 
) 
 
The BigQuery project or dataset location where the output is to be written to. If project is provided, a new dataset is created with name prediction_<model-display-name>_<job-create-time> 
where predictions 
, and errors 
. If the Model has both  instance 
 
and  prediction 
 
schemata defined then the tables have columns as follows: The predictions 
table contains instances for which the prediction succeeded, it has columns as per a concatenation of the Model's instance and prediction schemata. The errors 
table contains rows for which the prediction has failed, it has instance columns, as per the instance schema, followed by a single "errors" column, which as values has  google.rpc.Status 
 
represented as a STRUCT, and containing only code 
and message 
.
| JSON representation | 
|---|
| { "predictionsFormat" : string , // destination "gcsDestination" : { object ( | 
BatchDedicatedResources
A description of resources that are used for performing batch operations, are dedicated to a Model, and need manual configuration.
machineSpec 
 
  object (  MachineSpec 
 
) 
 
Required. Immutable. The specification of a single machine.
startingReplicaCount 
 
  integer 
 
Immutable. The number of machine replicas used at the start of the batch operation. If not set, Vertex AI decides starting number, not greater than  maxReplicaCount 
 
maxReplicaCount 
 
  integer 
 
Immutable. The maximum number of machine replicas the batch operation may be scaled to. The default value is 10.
| JSON representation | 
|---|
|  { 
 "machineSpec" 
 : 
 { 
 object (  | 
ManualBatchTuningParameters
Manual batch tuning parameters.
batchSize 
 
  integer 
 
Immutable. The number of the records (e.g. instances) of the operation given in each batch to a machine replica. Machine type, and size of a single record should be considered when setting this parameter, higher value speeds up the batch operation's execution, but too high value will result in a whole batch not fitting in a machine's memory, and the whole operation will fail. The default value is 64.
| JSON representation | 
|---|
| { "batchSize" : integer } | 
OutputInfo
Further describes this job's output. Supplements  outputConfig 
 
.
bigqueryOutputTable 
 
  string 
 
Output only. The name of the BigQuery table created, in predictions_<timestamp> 
format, into which the prediction output is written. Can be used by UI to generate the BigQuery output path, for example.
output_location 
 
  Union type 
 
 output_location 
can be only one of the following:gcsOutputDirectory 
 
  string 
 
Output only. The full path of the Cloud Storage directory created, into which the prediction output is written.
bigqueryOutputDataset 
 
  string 
 
Output only. The path of the BigQuery dataset created, in bq://projectId.bqDatasetId 
format, into which the prediction output is written.
| JSON representation | 
|---|
| { "bigqueryOutputTable" : string , // output_location "gcsOutputDirectory" : string , "bigqueryOutputDataset" : string // Union type } | 
ResourcesConsumed
Statistics information about resource consumption.
replicaHours 
 
  number 
 
Output only. The number of replica hours used. Note that many replicas may run in parallel, and additionally any given work may be queued for some time. Therefore this value is not strictly related to wall time.
| JSON representation | 
|---|
| { "replicaHours" : number } | 
CompletionStats
Success and error statistics of processing multiple entities (for example, DataItems or structured data rows) in batch.
successfulCount 
 
  string ( int64 
format) 
 
Output only. The number of entities that had been processed successfully.
failedCount 
 
  string ( int64 
format) 
 
Output only. The number of entities for which any error was encountered.
incompleteCount 
 
  string ( int64 
format) 
 
Output only. In cases when enough errors are encountered a job, pipeline, or operation may be failed as a whole. Below is the number of entities for which the processing had not been finished (either in successful or failed state). Set to -1 if the number is unknown (for example, the operation failed before the total entity number could be collected).
successfulForecastPointCount 
 
  string ( int64 
format) 
 
Output only. The number of the successful forecast points that are generated by the forecasting model. This is ONLY used by the forecasting batch prediction.
| JSON representation | 
|---|
| { "successfulCount" : string , "failedCount" : string , "incompleteCount" : string , "successfulForecastPointCount" : string } | 
| Methods | |
|---|---|
|   | Cancels a BatchPredictionJob. | 
|   | Creates a BatchPredictionJob. | 
|   | Deletes a BatchPredictionJob. | 
|   | Gets a BatchPredictionJob | 
|   | Lists BatchPredictionJobs in a Location. | 

