CreateJob

更新时间:
复制 MD 格式

Creates a task and returns the task ID.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

edas:CreateSchedulerxJobCreate

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID.

cn-hangzhou

Namespace

string

Yes

The namespace ID. You can find the ID on the Namespaces page in the console.

adcfc35d-e2fe-4fe9-bbaa-20e90ffc****

NamespaceSource

string

No

This parameter is required only for specific third-party integrations.

schedulerx

GroupId

string

Yes

The application ID. You can find the ID on the Application Management page in the console.

testSchedulerx.defaultGroup

JobType

string

Yes

The type of the job. Supported job types:

  • java

  • python

  • shell

  • go

  • http

  • xxljob

  • dataworks

  • k8s

  • springschedule

Valid values:

  • python :

    python

  • xxljob :

    xxljob

  • java :

    java

  • shell :

    shell

  • golang :

    golang

  • go :

    go

  • http :

    http

  • dataworks :

    dataworks

java

Name

string

Yes

The job name.

helloworld

Description

string

No

The job description.

Test

ExecuteMode

string

Yes

The job execution mode. Supported values:

  • Standalone: standalone

  • Broadcast: broadcast

  • Parallel computing: parallel

  • Batch processing: batch

  • Sharding: sharding

Valid values:

  • broadcast :

    broadcast

  • parallel :

    parallel computing

  • grid :

    in-memory grid

  • batch :

    batch processing

  • standalone :

    standalone

  • sharding :

    sharding

standalone

ClassName

string

No

The fully qualified class name of the job interface.

Required for java jobs.

com.alibaba.schedulerx.test.helloworld

Content

string

No

  • For a python, shell, or k8s job, this parameter specifies the script content.

  • For a go job, the content must be in the following format: {"jobName":"HelloWorld"}

echo 'hello'

Parameters

string

No

Custom parameters that the job can retrieve at runtime.

test

MaxConcurrency

integer

No

The maximum number of concurrent job instances. Defaults to 1. If an existing job instance is still running, a new one will not be triggered, even if its scheduled time has passed.

1

MaxAttempt

integer

No

The maximum number of retries for a failed job. Defaults to 0.

0

AttemptInterval

integer

No

The retry interval for a failed job, in seconds. Defaults to 30.

30

PageSize

integer

No

[Advanced] For parallel and grid jobs, this specifies the number of subtasks retrieved per pull. Defaults to 100.

100

ConsumerSize

integer

No

[Advanced] For parallel and grid jobs, this specifies the number of consumer threads per machine for processing subtasks. Defaults to 5.

5

QueueSize

integer

No

[Advanced] For parallel and grid jobs, this specifies the maximum number of subtasks the queue can hold. Defaults to 10000.

10000

DispatcherSize

integer

No

[Advanced] For parallel and grid jobs, this specifies the number of threads for dispatching subtasks. Defaults to 5.

5

TimeType

integer

Yes

The scheduling type. Supported values:

  • cron: 1

  • fixed_rate: 3

  • second_delay: 4

  • one_time : 5

  • api: 100

  • none: -1

Valid values:

  • 1 :

    1

  • 3 :

    3

  • 4 :

    4

  • 5 :

    5

  • 100 :

    100

1

TimeExpression

string

No

The time expression, which depends on the value of TimeType.

  • cron: A standard cron expression.

  • api: No time expression is required.

  • fixed_rate: A fixed interval in seconds. For example, a value of 30 triggers the job every 30 seconds.

  • second_delay: A fixed delay in seconds before the job is executed. Valid values: 1 to 60.

  • one_time: A specific time in yyyy-MM-dd HH:mm:ss format or a Unix timestamp in milliseconds. Example: "2022-10-10 10:10:00".

0 0/10 * * * ?

Calendar

string

No

For a cron job, you can specify a custom calendar.

DataOffset

integer

No

The time offset in seconds for a cron job.

2400

Timezone

string

No

The time zone.

GMT+8

TimeoutEnable

boolean

No

Specifies whether to enable timeout alerts. Valid values:

  • true: Enables timeout alerts.

  • false: Disables timeout alerts.

Valid values:

  • false :

    false

  • true :

    true

false

Timeout

integer

No

The timeout threshold in seconds. Defaults to 7200.

7200

TimeoutKillEnable

boolean

No

Specifies whether to terminate the job upon timeout. Valid values:

  • true: Terminates the job if it times out.

  • false: The job is not terminated if it times out.

Valid values:

  • false :

    false

  • true :

    true

false

FailEnable

boolean

No

Specifies whether to enable alerts for failed jobs. Valid values:

  • true: Enables failure alerts.

  • false: Disables failure alerts.

Valid values:

  • false :

    false

  • true :

    true

false

FailTimes

integer

No

The number of consecutive failures that triggers an alert.

2

MissWorkerEnable

boolean

No

Specifies whether to send an alert when no worker is available to run the job.

  • true: Enables the alert.

  • false: Disables the alert.

false

SuccessNoticeEnable

boolean

No

Specifies whether to send a notification when the job succeeds.

false

SendChannel

string

No

The channel for sending alerts.

  • For the default channel of the application group, use default.

  • For a specific channel for the job, use sms, mail, phone, or webhook.

Valid values:

  • default :

    default

  • webhook :

    webhook

  • mail :

    mail

  • phone :

    phone

  • sms :

    sms

sms

TaskMaxAttempt

integer

No

[Advanced] For parallel and grid jobs, this specifies the maximum number of retries for a failed subtask. Defaults to 0.

0

TaskAttemptInterval

integer

No

[Advanced] For parallel and grid jobs, this specifies the retry interval in seconds for a failed subtask. Defaults to 0.

0

ContactInfo

array<object>

No

The contact information for the job.

Important This parameter is deprecated.

1

object

No

The contact information for the job.

UserPhone

string

No

The mobile number of the alert contact.

1381111****

UserName

string

No

The name of the alert contact.

John Smith

UserMail

string

No

The email address of the alert contact.

test***@***.com

Ding

string

No

The webhook URL of the DingTalk group bot for alert notifications. For more information, see DingTalk Developer Documentation.

https://oapi.dingtalk.com/robot/send?access_token=**********

Status

integer

No

The job status. 1 = Enabled, 0 = Disabled. Defaults to 1.

1

XAttrs

string

No

This parameter is required for k8s jobs.
For job tasks: {"resource":"job"}
For shell tasks: {"image":"busybox","resource":"shell"}

{"resource":"job"}

Priority

integer

No

The job priority. Valid values:

  • 1: Low

  • 5: Medium

  • 10: High

  • 15: Very High

5

Response elements

Element

Type

Description

Example

object

Code

integer

The return code.

200

Message

string

The response message.

message

RequestId

string

The unique request ID.

39090022-1F3B-4797-8518-6B61095F1AF0

Success

boolean

Indicates whether the job was created. Valid values:

  • true: The job was created.

  • false: The job failed to be created.

true

Data

object

The job details.

JobId

integer

The job ID.

92583

Examples

Success response

JSON format

{
  "Code": 200,
  "Message": "message",
  "RequestId": "39090022-1F3B-4797-8518-6B61095F1AF0",
  "Success": true,
  "Data": {
    "JobId": 92583
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.