CreateJob

Updated at:
Copy as MD

Creates a job and returns the job 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 obtain the ID on the Namespaces page in the console.

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

NamespaceSource

string

No

The namespace source. This parameter is required only for specific third-party services.

schedulerx

GroupId

string

Yes

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

testSchedulerx.defaultGroup

JobType

string

Yes

The job type. Valid values:

  • 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. Valid values:

  • standalone: standalone mode.

  • broadcast: broadcast mode.

  • parallel: visualized MapReduce mode.

  • batch: MapReduce mode.

  • sharding: sharding mode.

Valid values:

  • broadcast :

    Broadcast mode.

  • parallel :

    Parallel computing.

  • grid :

    In-memory grid.

  • batch :

    Grid computing.

  • standalone :

    Standalone mode.

  • sharding :

    Sharding mode.

standalone

ClassName

string

No

The full path of the job interface class.

This parameter is required and must be a full path only when the job type is set to Java.

com.alibaba.schedulerx.test.helloworld

Content

string

No

  • If the job type is python, shell, or k8s, enter the corresponding script content.

  • If the job type is golang, the content format example is {"jobName":"HelloWorld"}.

echo 'hello'

Parameters

string

No

The custom parameters. These parameters can be obtained during runtime.

test

MaxConcurrency

integer

No

The maximum number of concurrently running instances. Default value: 1. If the previous triggered instance has not finished running, the next instance is not triggered even if the scheduled time is reached.

1

MaxAttempt

integer

No

The maximum number of retries allowed upon errors. Set this parameter based on your business requirements. Default value: 0.

0

AttemptInterval

integer

No

The retry interval upon errors. Unit: seconds. Default value: 30.

30

PageSize

integer

No

The advanced configuration for parallel grid jobs. The number of subtasks pulled at a time. Default value: 100.

100

ConsumerSize

integer

No

The advanced configuration for parallel grid jobs. The number of execution threads triggered on a single machine at a time. Default value: 5.

5

QueueSize

integer

No

The advanced configuration for parallel grid jobs. The maximum cache size of the subtask queue. Default value: 10000.

10000

DispatcherSize

integer

No

The advanced configuration for parallel grid jobs. The number of subtask dispatch threads. Default value: 5.

5

TimeType

integer

Yes

The scheduling time type. This parameter specifies the scheduling type, not a specific date, time, or timestamp. Valid values:

  • 1: cron

  • 3: fixed_rate

  • 4: second_delay

  • 5: one_time

  • 100: api

  • -1: none

Valid values:

  • 1 :

    1

  • 3 :

    3

  • 4 :

    4

  • 5 :

    5

  • 100 :

    100

1

TimeExpression

string

No

The time expression. Set the time expression based on the selected time type.

  • cron: Enter a standard cron expression. Online verification is supported.

  • api: No time expression is required.

  • fixed_rate: Enter a specific fixed frequency value. Unit: seconds. For example, 30 indicates that the job is triggered once every 30 seconds.

  • second_delay: Enter a fixed delay in seconds for execution (1s to 60s).

  • one_time: Enter a specific time (yyyy-MM-dd HH:mm:ss) or a timestamp in milliseconds, such as "2022-10-10 10:10:00".

0 0/10 * * * ?

Calendar

string

No

The custom calendar. This parameter is optional for the cron type.

workday

DataOffset

integer

No

The time offset. Unit: seconds. This parameter is optional for the cron type.

2400

Timezone

string

No

The time zone.

GMT+8

TimeoutEnable

boolean

No

Specifies whether to enable the timeout alert. Valid values:

  • true: enables the timeout alert.

  • false: disables the timeout alert.

Valid values:

  • false :

    false

  • true :

    true

false

Timeout

integer

No

The timeout threshold. Unit: seconds. Default value: 7200.

7200

TimeoutKillEnable

boolean

No

Specifies whether to enable the timeout termination feature. Valid values:

  • true: enables the timeout termination feature.

  • false: disables the timeout termination feature.

Valid values:

  • false :

    false

  • true :

    true

false

FailEnable

boolean

No

Specifies whether to enable the failure alert. Valid values:

  • true: enables the failure alert.

  • false: disables the failure alert.

Valid values:

  • false :

    false

  • true :

    true

false

FailTimes

integer

No

The number of consecutive failures that trigger an alert.

2

MissWorkerEnable

boolean

No

Specifies whether to enable the alert for no available workers. Valid values:

  • true: enables the alert for no available workers.

  • false: disables the alert for no available workers.

false

SuccessNoticeEnable

boolean

No

Specifies whether to enable the success notification.

false

SendChannel

string

No

The alert notification channel. Valid values:

  • default: the default channel for application groups.

  • sms, mail, phone, webhook: specified channels for the job.

Valid values:

  • default :

    default

  • webhook :

    webhook

  • mail :

    mail

  • phone :

    phone

  • sms :

    sms

sms

TaskMaxAttempt

integer

No

The advanced configuration for parallel grid jobs. The number of retries allowed for a failed subtask. Default value: 0.

0

TaskAttemptInterval

integer

No

The advanced configuration for parallel grid jobs. The retry interval for a failed subtask. Default value: 0.

0

ContactInfo

array<object>

No

[Deprecated] The job contact information.

object

No

The job contact information.

Ding

string

No

The webhook URL of the DingTalk group chatbot for the alert contact. References: DingTalk development documentation.

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

UserMail

string

No

The email address of the alert contact.

test***@***.com

UserName

string

No

The name of the alert contact.

John Smith

UserPhone

string

No

The mobile phone number of the alert contact.

1381111****

Status

integer

No

The job status. Valid values:

  • 0: disabled

  • 1: enabled Default value: 1.

Valid values:

  • 0 :

    Disabled.

  • 1 :

    Enabled.

1

XAttrs

string

No

The extended attributes. This parameter is required if the job type is k8s.

  • Job task: {"resource":"job"}

  • Shell task: {"image":"busybox","resource":"shell"}

{"resource":"job"}

Priority

integer

No

The job priority. Valid values:

  • 1: low

  • 5: medium

  • 10: high

  • 15: very high

5

StartTime

integer

No

The start timestamp. Unit: milliseconds. The value must be later than the current time. A value of -1 indicates that the job starts immediately.

1789454134000

EndTime

integer

No

The expiration timestamp of the job. Unit: milliseconds. The value must be later than the current time and the start time. A value of -1 indicates that the job never expires.

1789454134000

Response elements

Element

Type

Description

Example

object

Code

integer

The return code.

200

Data

object

The job details.

JobId

integer

The job ID.

92583

Message

string

The additional information.

message

RequestId

string

The 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

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.