Class JobOperations

    • Method Detail

      • getJob

        public CloudJob getJob​(String jobId)
                        throws BatchErrorException,
                               IOException
        Gets the specified CloudJob.
        Parameters:
        jobId - The ID of the job to get.
        Returns:
        A CloudJob containing information about the specified Azure Batch job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getJob

        public CloudJob getJob​(String jobId,
                               DetailLevel detailLevel)
                        throws BatchErrorException,
                               IOException
        Gets the specified CloudJob.
        Parameters:
        jobId - The ID of the job to get.
        detailLevel - A DetailLevel used for controlling which properties are retrieved from the service.
        Returns:
        A CloudJob containing information about the specified Azure Batch job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • listJobs

        public com.microsoft.azure.PagedList<CloudJob> listJobs()
                                                         throws BatchErrorException,
                                                                IOException
        Lists the jobs in the Batch account.
        Returns:
        A list of CloudJob objects.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • listJobs

        public com.microsoft.azure.PagedList<CloudJob> listJobs​(DetailLevel detailLevel)
                                                         throws BatchErrorException,
                                                                IOException
        Lists the jobs in the Batch account.
        Parameters:
        detailLevel - A DetailLevel used for filtering the list and for controlling which properties are retrieved from the service.
        Returns:
        A list of CloudJob objects.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • listJobs

        public com.microsoft.azure.PagedList<CloudJob> listJobs​(DetailLevel detailLevel,
                                                                Iterable<BatchClientBehavior> additionalBehaviors)
                                                         throws BatchErrorException,
                                                                IOException
        Lists the jobs in the Batch account.
        Parameters:
        detailLevel - A DetailLevel used for filtering the list and for controlling which properties are retrieved from the service.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Returns:
        A list of CloudJob objects.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • listJobs

        public com.microsoft.azure.PagedList<CloudJob> listJobs​(String jobScheduleId)
                                                         throws BatchErrorException,
                                                                IOException
        Lists the jobs created under the specified job schedule.
        Parameters:
        jobScheduleId - The ID of job schedule.
        Returns:
        A list of CloudJob objects.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • listJobs

        public com.microsoft.azure.PagedList<CloudJob> listJobs​(String jobScheduleId,
                                                                DetailLevel detailLevel)
                                                         throws BatchErrorException,
                                                                IOException
        Lists the jobs created under the specified job schedule.
        Parameters:
        jobScheduleId - The ID of job schedule.
        detailLevel - A DetailLevel used for filtering the list and for controlling which properties are retrieved from the service.
        Returns:
        A list of CloudJob objects.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • listJobs

        public com.microsoft.azure.PagedList<CloudJob> listJobs​(String jobScheduleId,
                                                                DetailLevel detailLevel,
                                                                Iterable<BatchClientBehavior> additionalBehaviors)
                                                         throws BatchErrorException,
                                                                IOException
        Lists the jobs created under the specified jobSchedule.
        Parameters:
        jobScheduleId - The ID of jobSchedule.
        detailLevel - A DetailLevel used for filtering the list and for controlling which properties are retrieved from the service.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Returns:
        A list of CloudJob objects.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • createJob

        public void createJob​(String jobId,
                              PoolInformation poolInfo)
                       throws BatchErrorException,
                              IOException
        Adds a job to the Batch account.
        Parameters:
        jobId - The ID of the job to be added.
        poolInfo - Specifies how a job should be assigned to a pool.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • createJob

        public void createJob​(String jobId,
                              PoolInformation poolInfo,
                              Iterable<BatchClientBehavior> additionalBehaviors)
                       throws BatchErrorException,
                              IOException
        Adds a job to the Batch account.
        Parameters:
        jobId - The ID of the job to be added.
        poolInfo - Specifies how a job should be assigned to a pool.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • createJob

        public void createJob​(JobAddParameter job)
                       throws BatchErrorException,
                              IOException
        Adds a job to the Batch account.
        Parameters:
        job - The job to be added.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • deleteJob

        public void deleteJob​(String jobId)
                       throws BatchErrorException,
                              IOException
        Deletes the specified job.
        Parameters:
        jobId - The ID of the job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • deleteJob

        public void deleteJob​(String jobId,
                              Iterable<BatchClientBehavior> additionalBehaviors)
                       throws BatchErrorException,
                              IOException
        Deletes the specified job.
        Parameters:
        jobId - The ID of the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • terminateJob

        public void terminateJob​(String jobId)
                          throws BatchErrorException,
                                 IOException
        Terminates the specified job, marking it as completed.
        Parameters:
        jobId - The ID of the job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • terminateJob

        public void terminateJob​(String jobId,
                                 String terminateReason)
                          throws BatchErrorException,
                                 IOException
        Terminates the specified job, marking it as completed.
        Parameters:
        jobId - The ID of the job.
        terminateReason - The message to describe the reason the job has terminated. This text will appear when you call JobExecutionInformation.terminateReason().
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • enableJob

        public void enableJob​(String jobId)
                       throws BatchErrorException,
                              IOException
        Enables the specified job, allowing new tasks to run.
        Parameters:
        jobId - The ID of the job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • enableJob

        public void enableJob​(String jobId,
                              Iterable<BatchClientBehavior> additionalBehaviors)
                       throws BatchErrorException,
                              IOException
        Enables the specified job, allowing new tasks to run.
        Parameters:
        jobId - The ID of the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • disableJob

        public void disableJob​(String jobId,
                               DisableJobOption disableJobOption)
                        throws BatchErrorException,
                               IOException
        Disables the specified job. Disabled jobs do not run new tasks, but may be re-enabled later.
        Parameters:
        jobId - The ID of the job.
        disableJobOption - Specifies what to do with running tasks associated with the job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • disableJob

        public void disableJob​(String jobId,
                               DisableJobOption disableJobOption,
                               Iterable<BatchClientBehavior> additionalBehaviors)
                        throws BatchErrorException,
                               IOException
        Disables the specified job. Disabled jobs do not run new tasks, but may be re-enabled later.
        Parameters:
        jobId - The ID of the job.
        disableJobOption - Specifies what to do with running tasks associated with the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • updateJob

        public void updateJob​(String jobId,
                              PoolInformation poolInfo,
                              Integer priority,
                              JobConstraints constraints,
                              OnAllTasksComplete onAllTasksComplete,
                              List<MetadataItem> metadata)
                       throws BatchErrorException,
                              IOException
        Updates the specified job. This method performs a full replace of all updatable properties of the job. For example, if the constraints parameter is null, then the Batch service removes the job's existing constraints and replaces them with the default constraints.
        Parameters:
        jobId - The ID of the job.
        poolInfo - The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job.
        priority - The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, it is set to the default value 0.
        constraints - The execution constraints for the job. If null, the constraints are cleared.
        onAllTasksComplete - Specifies an action the Batch service should take when all tasks in the job are in the completed state.
        metadata - A list of name-value pairs associated with the job as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • updateJob

        public void updateJob​(String jobId,
                              PoolInformation poolInfo,
                              Integer priority,
                              JobConstraints constraints,
                              OnAllTasksComplete onAllTasksComplete,
                              List<MetadataItem> metadata,
                              Iterable<BatchClientBehavior> additionalBehaviors)
                       throws BatchErrorException,
                              IOException
        Updates the specified job. This method performs a full replace of all updatable properties of the job. For example, if the constraints parameter is null, then the Batch service removes the job's existing constraints and replaces them with the default constraints.
        Parameters:
        jobId - The ID of the job.
        poolInfo - The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job.
        priority - The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, it is set to the default value 0.
        constraints - The execution constraints for the job. If null, the constraints are cleared.
        onAllTasksComplete - Specifies an action the Batch service should take when all tasks in the job are in the completed state.
        metadata - A list of name-value pairs associated with the job as metadata. If null, it takes the default value of an empty list; in effect, any existing metadata is deleted.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • updateJob

        public void updateJob​(String jobId,
                              JobUpdateParameter param,
                              Iterable<BatchClientBehavior> additionalBehaviors)
                       throws BatchErrorException,
                              IOException
        Updates the specified job This method performs a full replace of all updatable properties of the job. For example, if the constraints parameter is null, then the Batch service removes the job's existing constraints and replaces them with the default constraints.
        Parameters:
        jobId - The job to be updated.
        param - Job Update parameters
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • patchJob

        public void patchJob​(String jobId,
                             PoolInformation poolInfo)
                      throws BatchErrorException,
                             IOException
        Updates the specified job. This method only replaces the properties specified with non-null values.
        Parameters:
        jobId - The ID of the job.
        poolInfo - The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • patchJob

        public void patchJob​(String jobId,
                             OnAllTasksComplete onAllTasksComplete)
                      throws BatchErrorException,
                             IOException
        Updates the specified job. This method only replaces the properties specified with non-null values.
        Parameters:
        jobId - The ID of the job.
        onAllTasksComplete - Specifies an action the Batch service should take when all tasks in the job are in the completed state.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • patchJob

        public void patchJob​(String jobId,
                             PoolInformation poolInfo,
                             Integer priority,
                             JobConstraints constraints,
                             OnAllTasksComplete onAllTasksComplete,
                             List<MetadataItem> metadata)
                      throws BatchErrorException,
                             IOException
        Updates the specified job. This method only replaces the properties specified with non-null values.
        Parameters:
        jobId - The ID of the job.
        poolInfo - The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool.
        priority - The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, the priority of the job is left unchanged.
        constraints - The execution constraints for the job. If null, the existing execution constraints are left unchanged.
        onAllTasksComplete - Specifies an action the Batch service should take when all tasks in the job are in the completed state.
        metadata - A list of name-value pairs associated with the job as metadata. If null, the existing job metadata is left unchanged.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • patchJob

        public void patchJob​(String jobId,
                             PoolInformation poolInfo,
                             Integer priority,
                             JobConstraints constraints,
                             OnAllTasksComplete onAllTasksComplete,
                             List<MetadataItem> metadata,
                             Iterable<BatchClientBehavior> additionalBehaviors)
                      throws BatchErrorException,
                             IOException
        Updates the specified job. This method only replaces the properties specified with non-null values.
        Parameters:
        jobId - The ID of the job.
        poolInfo - The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool.
        priority - The priority of the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. If null, the priority of the job is left unchanged.
        constraints - The execution constraints for the job. If null, the existing execution constraints are left unchanged.
        onAllTasksComplete - Specifies an action the Batch service should take when all tasks in the job are in the completed state.
        metadata - A list of name-value pairs associated with the job as metadata. If null, the existing job metadata is left unchanged.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • patchJob

        public void patchJob​(String jobId,
                             JobPatchParameter jobPatchParameter)
                      throws BatchErrorException,
                             IOException
        Updates the specified job. This method only replaces the properties specified with non-null values.
        Parameters:
        jobId - The ID of the job.
        jobPatchParameter - The set of changes to be made to a job.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • patchJob

        public void patchJob​(String jobId,
                             JobPatchParameter jobPatchParameter,
                             Iterable<BatchClientBehavior> additionalBehaviors)
                      throws BatchErrorException,
                             IOException
        Updates the specified job. This method only replaces the properties specified with non-null values.
        Parameters:
        jobId - The ID of the job.
        jobPatchParameter - The parameter to update the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Throws:
        BatchErrorException - Exception thrown when an error response is received from the Batch service.
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getTaskCounts

        public TaskCounts getTaskCounts​(String jobId)
                                 throws BatchErrorException,
                                        IOException
        Gets the task counts for the specified job. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running.
        Parameters:
        jobId - The ID of the job.
        Returns:
        the TaskCounts object if successful.
        Throws:
        BatchErrorException - thrown if the request is rejected by server
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getTaskCounts

        public TaskCounts getTaskCounts​(String jobId,
                                        Iterable<BatchClientBehavior> additionalBehaviors)
                                 throws BatchErrorException,
                                        IOException
        Gets the task counts for the specified job. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running.
        Parameters:
        jobId - The ID of the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Returns:
        the TaskCounts object if successful.
        Throws:
        BatchErrorException - thrown if the request is rejected by server
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getTaskSlotCounts

        public TaskSlotCounts getTaskSlotCounts​(String jobId)
                                         throws BatchErrorException,
                                                IOException
        Gets the task slot counts for the specified job. Task slot counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running.
        Parameters:
        jobId - The ID of the job.
        Returns:
        the TaskSlotCounts object if successful.
        Throws:
        BatchErrorException - thrown if the request is rejected by server
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getTaskSlotCounts

        public TaskSlotCounts getTaskSlotCounts​(String jobId,
                                                Iterable<BatchClientBehavior> additionalBehaviors)
                                         throws BatchErrorException,
                                                IOException
        Gets the task slot counts for the specified job. Task slot counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running.
        Parameters:
        jobId - The ID of the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Returns:
        the TaskSlotCounts object if successful.
        Throws:
        BatchErrorException - thrown if the request is rejected by server
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getTaskCountsResult

        public TaskCountsResult getTaskCountsResult​(String jobId)
                                             throws BatchErrorException,
                                                    IOException
        Gets the task counts result for the specified job. The result includes both task counts and task slot counts. Each counts object provides a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running.
        Parameters:
        jobId - The ID of the job.
        Returns:
        the TaskCountsResult object if successful.
        Throws:
        BatchErrorException - thrown if the request is rejected by server
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
      • getTaskCountsResult

        public TaskCountsResult getTaskCountsResult​(String jobId,
                                                    Iterable<BatchClientBehavior> additionalBehaviors)
                                             throws BatchErrorException,
                                                    IOException
        Gets the task counts result for the specified job. The result includes both task counts and task slot counts. Each counts object provides a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running.
        Parameters:
        jobId - The ID of the job.
        additionalBehaviors - A collection of BatchClientBehavior instances that are applied to the Batch service request.
        Returns:
        the TaskCountsResult object if successful.
        Throws:
        BatchErrorException - thrown if the request is rejected by server
        IOException - Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.