update-job-status

Updated at:

The update-job-status command updates the status of a specified batch job.

Usage notes

By default, an Alibaba Cloud account has the permissions to update the status of a batch job. To perform this operation by using a RAM user or Security Token Service (STS), you must have the oss:UpdateJobStatus permission. For more information, see Grant a custom policy.

  • A status update affects the execution of the job. Proceed with caution.

Command syntax

ossutil api update-job-status --batch-job-id value --requested-job-status value [flags]

Parameter

Type

Description

--batch-job-id

string

The ID of the batch job. The value must be 44 characters in length and can contain lowercase letters (a-z), uppercase letters (A-Z), and digits (0-9). It cannot contain hyphens (-) or underscores (_). You can obtain the ID by using the create-job or list-jobs command.

--requested-job-status

string

The status to which you want to update the job. Valid values: Cancelled and Ready. If the current status of the job is Cancelled, Cancelling, Complete, Completing, Failed, or Failing, you cannot set the status to Cancelled. Only a job in the Suspended or Preparing state can be set to Ready.

--status-update-reason

string

The reason for the status update. The value must be 1 to 256 characters in length. This option is optional if --requested-job-status is set to Ready.

Note
  • This command requires ossutil 2.4.1 or later.

  • For more information about the supported global command-line options, see Global command-line options.

Usage examples

Cancel the batch job whose ID is MzRjZGU2.

ossutil api update-job-status --batch-job-id MzRjZGU2 --requested-job-status Cancelled --status-update-reason "User requested cancellation"

Set the status of the batch job whose ID is MzRjZGU2 to Ready so that a job in the Suspended state continues to run.

ossutil api update-job-status --batch-job-id MzRjZGU2 --requested-job-status Ready

Cancel the batch job whose ID is MzRjZGU2 and display the output in JSON format.

ossutil api update-job-status --batch-job-id MzRjZGU2 --requested-job-status Cancelled --status-update-reason "User requested cancellation" --output-format json