Class BatchJobSpecification

java.lang.Object
com.azure.compute.batch.models.BatchJobSpecification
All Implemented Interfaces:
com.azure.json.JsonSerializable<BatchJobSpecification>

public final class BatchJobSpecification extends Object implements com.azure.json.JsonSerializable<BatchJobSpecification>
Specifies details of the Jobs to be created on a schedule.
  • Constructor Details

    • BatchJobSpecification

      public BatchJobSpecification(BatchPoolInfo poolInfo)
      Creates an instance of BatchJobSpecification class.
      Parameters:
      poolInfo - the poolInfo value to set.
  • Method Details

    • getPriority

      public Integer getPriority()
      Get the priority property: The priority of Jobs created under this schedule. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. This priority is used as the default for all Jobs under the Job Schedule. You can update a Job's priority after it has been created using by using the update Job API.
      Returns:
      the priority value.
    • setPriority

      public BatchJobSpecification setPriority(Integer priority)
      Set the priority property: The priority of Jobs created under this schedule. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0. This priority is used as the default for all Jobs under the Job Schedule. You can update a Job's priority after it has been created using by using the update Job API.
      Parameters:
      priority - the priority value to set.
      Returns:
      the BatchJobSpecification object itself.
    • isAllowTaskPreemption

      public Boolean isAllowTaskPreemption()
      Get the allowTaskPreemption property: Whether Tasks in this job can be preempted by other high priority jobs. If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.
      Returns:
      the allowTaskPreemption value.
    • setAllowTaskPreemption

      public BatchJobSpecification setAllowTaskPreemption(Boolean allowTaskPreemption)
      Set the allowTaskPreemption property: Whether Tasks in this job can be preempted by other high priority jobs. If the value is set to True, other high priority jobs submitted to the system will take precedence and will be able requeue tasks from this job. You can update a job's allowTaskPreemption after it has been created using the update job API.
      Parameters:
      allowTaskPreemption - the allowTaskPreemption value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getMaxParallelTasks

      public Integer getMaxParallelTasks()
      Get the maxParallelTasks property: The maximum number of tasks that can be executed in parallel for the job. The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.
      Returns:
      the maxParallelTasks value.
    • setMaxParallelTasks

      public BatchJobSpecification setMaxParallelTasks(Integer maxParallelTasks)
      Set the maxParallelTasks property: The maximum number of tasks that can be executed in parallel for the job. The value of maxParallelTasks must be -1 or greater than 0 if specified. If not specified, the default value is -1, which means there's no limit to the number of tasks that can be run at once. You can update a job's maxParallelTasks after it has been created using the update job API.
      Parameters:
      maxParallelTasks - the maxParallelTasks value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getDisplayName

      public String getDisplayName()
      Get the displayName property: The display name for Jobs created under this schedule. The name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
      Returns:
      the displayName value.
    • setDisplayName

      public BatchJobSpecification setDisplayName(String displayName)
      Set the displayName property: The display name for Jobs created under this schedule. The name need not be unique and can contain any Unicode characters up to a maximum length of 1024.
      Parameters:
      displayName - the displayName value to set.
      Returns:
      the BatchJobSpecification object itself.
    • isUsesTaskDependencies

      public Boolean isUsesTaskDependencies()
      Get the usesTaskDependencies property: Whether Tasks in the Job can define dependencies on each other. The default is false.
      Returns:
      the usesTaskDependencies value.
    • setUsesTaskDependencies

      public BatchJobSpecification setUsesTaskDependencies(Boolean usesTaskDependencies)
      Set the usesTaskDependencies property: Whether Tasks in the Job can define dependencies on each other. The default is false.
      Parameters:
      usesTaskDependencies - the usesTaskDependencies value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getOnAllTasksComplete

      public OnAllBatchTasksComplete getOnAllTasksComplete()
      Get the onAllTasksComplete property: The action the Batch service should take when all Tasks in a Job created under this schedule are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction.
      Returns:
      the onAllTasksComplete value.
    • setOnAllTasksComplete

      public BatchJobSpecification setOnAllTasksComplete(OnAllBatchTasksComplete onAllTasksComplete)
      Set the onAllTasksComplete property: The action the Batch service should take when all Tasks in a Job created under this schedule are in the completed state. Note that if a Job contains no Tasks, then all Tasks are considered complete. This option is therefore most commonly used with a Job Manager task; if you want to use automatic Job termination without a Job Manager, you should initially set onAllTasksComplete to noaction and update the Job properties to set onAllTasksComplete to terminatejob once you have finished adding Tasks. The default is noaction.
      Parameters:
      onAllTasksComplete - the onAllTasksComplete value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getOnTaskFailure

      public OnBatchTaskFailure getOnTaskFailure()
      Get the onTaskFailure property: The action the Batch service should take when any Task fails in a Job created under this schedule. A Task is considered to have failed if it have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction.
      Returns:
      the onTaskFailure value.
    • setOnTaskFailure

      public BatchJobSpecification setOnTaskFailure(OnBatchTaskFailure onTaskFailure)
      Set the onTaskFailure property: The action the Batch service should take when any Task fails in a Job created under this schedule. A Task is considered to have failed if it have failed if has a failureInfo. A failureInfo is set if the Task completes with a non-zero exit code after exhausting its retry count, or if there was an error starting the Task, for example due to a resource file download error. The default is noaction.
      Parameters:
      onTaskFailure - the onTaskFailure value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getNetworkConfiguration

      public BatchJobNetworkConfiguration getNetworkConfiguration()
      Get the networkConfiguration property: The network configuration for the Job.
      Returns:
      the networkConfiguration value.
    • setNetworkConfiguration

      public BatchJobSpecification setNetworkConfiguration(BatchJobNetworkConfiguration networkConfiguration)
      Set the networkConfiguration property: The network configuration for the Job.
      Parameters:
      networkConfiguration - the networkConfiguration value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getConstraints

      public BatchJobConstraints getConstraints()
      Get the constraints property: The execution constraints for Jobs created under this schedule.
      Returns:
      the constraints value.
    • setConstraints

      public BatchJobSpecification setConstraints(BatchJobConstraints constraints)
      Set the constraints property: The execution constraints for Jobs created under this schedule.
      Parameters:
      constraints - the constraints value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getJobManagerTask

      public BatchJobManagerTask getJobManagerTask()
      Get the jobManagerTask property: The details of a Job Manager Task to be launched when a Job is started under this schedule. If the Job does not specify a Job Manager Task, the user must explicitly add Tasks to the Job using the Task API. If the Job does specify a Job Manager Task, the Batch service creates the Job Manager Task when the Job is created, and will try to schedule the Job Manager Task before scheduling other Tasks in the Job.
      Returns:
      the jobManagerTask value.
    • setJobManagerTask

      public BatchJobSpecification setJobManagerTask(BatchJobManagerTask jobManagerTask)
      Set the jobManagerTask property: The details of a Job Manager Task to be launched when a Job is started under this schedule. If the Job does not specify a Job Manager Task, the user must explicitly add Tasks to the Job using the Task API. If the Job does specify a Job Manager Task, the Batch service creates the Job Manager Task when the Job is created, and will try to schedule the Job Manager Task before scheduling other Tasks in the Job.
      Parameters:
      jobManagerTask - the jobManagerTask value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getJobPreparationTask

      public BatchJobPreparationTask getJobPreparationTask()
      Get the jobPreparationTask property: The Job Preparation Task for Jobs created under this schedule. If a Job has a Job Preparation Task, the Batch service will run the Job Preparation Task on a Node before starting any Tasks of that Job on that Compute Node.
      Returns:
      the jobPreparationTask value.
    • setJobPreparationTask

      public BatchJobSpecification setJobPreparationTask(BatchJobPreparationTask jobPreparationTask)
      Set the jobPreparationTask property: The Job Preparation Task for Jobs created under this schedule. If a Job has a Job Preparation Task, the Batch service will run the Job Preparation Task on a Node before starting any Tasks of that Job on that Compute Node.
      Parameters:
      jobPreparationTask - the jobPreparationTask value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getJobReleaseTask

      public BatchJobReleaseTask getJobReleaseTask()
      Get the jobReleaseTask property: The Job Release Task for Jobs created under this schedule. The primary purpose of the Job Release Task is to undo changes to Nodes made by the Job Preparation Task. Example activities include deleting local files, or shutting down services that were started as part of Job preparation. A Job Release Task cannot be specified without also specifying a Job Preparation Task for the Job. The Batch service runs the Job Release Task on the Compute Nodes that have run the Job Preparation Task.
      Returns:
      the jobReleaseTask value.
    • setJobReleaseTask

      public BatchJobSpecification setJobReleaseTask(BatchJobReleaseTask jobReleaseTask)
      Set the jobReleaseTask property: The Job Release Task for Jobs created under this schedule. The primary purpose of the Job Release Task is to undo changes to Nodes made by the Job Preparation Task. Example activities include deleting local files, or shutting down services that were started as part of Job preparation. A Job Release Task cannot be specified without also specifying a Job Preparation Task for the Job. The Batch service runs the Job Release Task on the Compute Nodes that have run the Job Preparation Task.
      Parameters:
      jobReleaseTask - the jobReleaseTask value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getCommonEnvironmentSettings

      public List<EnvironmentSetting> getCommonEnvironmentSettings()
      Get the commonEnvironmentSettings property: A list of common environment variable settings. These environment variables are set for all Tasks in Jobs created under this schedule (including the Job Manager, Job Preparation and Job Release Tasks). Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value.
      Returns:
      the commonEnvironmentSettings value.
    • setCommonEnvironmentSettings

      public BatchJobSpecification setCommonEnvironmentSettings(List<EnvironmentSetting> commonEnvironmentSettings)
      Set the commonEnvironmentSettings property: A list of common environment variable settings. These environment variables are set for all Tasks in Jobs created under this schedule (including the Job Manager, Job Preparation and Job Release Tasks). Individual Tasks can override an environment setting specified here by specifying the same setting name with a different value.
      Parameters:
      commonEnvironmentSettings - the commonEnvironmentSettings value to set.
      Returns:
      the BatchJobSpecification object itself.
    • getPoolInfo

      public BatchPoolInfo getPoolInfo()
      Get the poolInfo property: The Pool on which the Batch service runs the Tasks of Jobs created under this schedule.
      Returns:
      the poolInfo value.
    • getMetadata

      public List<MetadataItem> getMetadata()
      Get the metadata property: A list of name-value pairs associated with each Job created under this schedule as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code.
      Returns:
      the metadata value.
    • setMetadata

      public BatchJobSpecification setMetadata(List<MetadataItem> metadata)
      Set the metadata property: A list of name-value pairs associated with each Job created under this schedule as metadata. The Batch service does not assign any meaning to metadata; it is solely for the use of user code.
      Parameters:
      metadata - the metadata value to set.
      Returns:
      the BatchJobSpecification object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<BatchJobSpecification>
      Throws:
      IOException
    • fromJson

      public static BatchJobSpecification fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of BatchJobSpecification from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of BatchJobSpecification if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the BatchJobSpecification.