Job management

Updated at:
Copy as MD

Create and manage XXL-JOB scheduling jobs, including job configuration, scheduling, alerting, and batch operations.

Create a scheduling job

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management, and then click Create Job. On the Basic Configuration wizard page, configure the job and click Next.

    image

    Category

    Configuration Item

    Description

    Default value

    Basic Configuration

    Job Name

    The job name, which must be unique within the same application.

    None

    Job Description

    The description of the job.

    None

    Associated Application

    The application to which the job belongs.

    None

    Job Type

    Supported job types: BEAN, Dify workflow, GLUE (Java), GLUE (Shell), GLUE (Python), GLUE (PHP), GLUE (NodeJs), and GLUE (PowerShell).

    BEAN

    JobHandler Name

    The jobHandler declared by the @Xxljob annotation on the executor.

    None

    Routing Policy

    The routing policy. Valid values are Round-robin, Random, First, Last, Least Frequently Used, Least Recently Used, Consistent Hashing, and Shard Broadcast.

    Round-robin

    Blocked Job Processing Policy

    • Serial Execution: The job waits in a queue and is executed after the previous job is complete.

    • Discard Subsequent Schedules: New jobs are discarded and not executed.

    • Overwrite Previous Schedule: The previous job is discarded, and the new job is executed immediately.

    Serial Execution

    Priority

    Low, Medium, High, and Very High.

    Middle

    Input

    The parameters for the job. The maximum length is 2000 bytes.

    None

    Advanced Configuration

    Job failure retry attempts

    The maximum number of automatic retries after a job fails.

    0

    Job failure retry interval

    The interval between retries after a job fails. Unit: seconds.

    30 seconds

    Job concurrency

    The maximum number of concurrent instances for the same job. If set to 1, concurrent execution is not allowed. If the limit is exceeded, the current schedule is skipped.

    1

    Child job ID

    The ID of the child job.

    Note

    After the parent job is successfully executed, the child job is triggered. You can enter multiple child job IDs, separated by commas (,).

    None

  4. On the Scheduling Configuration wizard page, set the scheduling parameters and advanced configuration parameters, and then click Next.

    image

    Configuration item

    Description

    Default value

    Time Type

    The schedule type. Valid values are none, cron, api, fixed_rate, fixed_delay, and one_time.

    cron

    Time Expression

    The expression varies based on the time type:

    • none: No expression is required.

    • cron: A cron expression that is accurate to the second.

    • fixed_rate: A fixed execution frequency in seconds. The job is scheduled every N seconds.

    • fixed_delay: A fixed delay in seconds. The next job is scheduled N seconds after the previous one completes.

    • api: The job is scheduled by an OpenAPI call.

    • one_time: A one-time job that is automatically destroyed after it runs. The format is "yyyy-MM-dd HH:mm:ss", for example, "2024-10-10 12:12:20".

    None

    Data timestamp offset

    The offset of the data timestamp relative to the scheduled time. You can obtain this value from the scheduling context.

    None

    Time zone

    Runs the job in a fixed time zone. Mainly applicable to cron expressions.

    Time zone of the current region

    Calendar

    Import a custom calendar to schedule jobs, for example, to run a job only on weekdays.

    Daily schedule

    Effective time

    The time when the job becomes active.

    Effective immediately

  5. On the Notification Configuration wizard page, set the alerting parameters and contacts, and then click Finish.

    image

    Parameter

    Description

    Default value

    Timeout alerting

    Whether to send an alert when the job execution times out.

    Enable

    Timeout period

    The timeout period for job execution. Unit: seconds.

    7200 seconds

    Stop on timeout

    Whether to automatically stop a job that exceeds its timeout period, preventing it from blocking the next scheduled run.

    Disabled

    Success notification

    Whether to notify contacts when the job succeeds. Typically used for important, day-level jobs.

    Disabled

    Failure alerting

    Whether to send an alert when the job fails.

    Enabled

    Consecutive Failure Count

    The number of consecutive failures that must occur before an alert is sent.

    1

    No available machine alerting

    Whether to send an alert when no executor is available at the scheduled time.

    Enabled

    Notification method

    The notification method. Valid values are text message, webhook, email, and phone.

    None

    Notification Recipient

    Integrates with Cloud Monitor contacts. You must configure contacts in the Cloud Monitor console and activate their contact methods.

    None

    If you use webhook alerting for DingTalk, WeCom, or Lark, alerts are sent over the public network. You must attach an Internet NAT gateway to your VPC, as shown in the following figure.

    image

Edit a scheduling job

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click Edit. In the Edit Job panel, modify the Basic Configuration, Scheduling Configuration, and Notification Configuration, and then click Finish.

Delete a scheduling job

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click More Delete. In the Delete dialog box, click Delete.

Import jobs

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. Click Import Jobs. In the Import Jobs dialog box, for Existing Job, select Overwrite or Skip. Set the Automatically Create App option. Click Select File to upload a file, and then click OK.

Export jobs

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. Click Export Jobs. In the Export Jobs dialog box, select the application name for the jobs you want to export, and then click OK.

Enable jobs in batches

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. Select the jobs you want to enable and click Enable Jobs in Batches. In the Enable Jobs in Batches dialog box, click OK.

Disable jobs in batches

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the target instance. In the navigation pane on the left, click Task Management.

  4. Select the jobs you want to disable and click Disable Jobs in Batches. In the Disable Jobs in Batches dialog box, click OK.

Delete jobs in batches

Important

Deleted jobs cannot be recovered.

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. Select the jobs you want to delete and click Delete Jobs in Batches. In the Delete Jobs in Batches dialog box, click OK.

Run a scheduling job once

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click Run Once. In the Run Job Manually dialog box, specify the executor machine and job parameters, and then click OK.

Copy a scheduling job

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click More Copy. In the Copy Job panel, configure the Basic Configuration, Scheduling Configuration, and Notification Configuration, and then click Finish.

Disable a scheduling job

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click More Disable. In the Disable dialog box, click Disable.

View scheduling records

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click More Scheduling Records to view the scheduling and execution records for the job.

Rerun a job

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the target instance. In the navigation pane on the left, click Task Management.

  4. In the Operation column of the target job, click More Rerun Job. In the Rerun Job panel, select the Start and End Dates and Data Timestamp, and then click OK.

Designate a machine

  1. Log on to the MSE XXL-JOB console, and select a region in the top navigation bar.

  2. In the left navigation bar, select Task Scheduling > XXL-JOB Edition.

  3. Click the ID of the target instance. In the navigation pane on the left, click Job management.

  4. In the Operation column of the target job, click More Designate Machine. In the Designate Machine panel, set Designation Type to Address or Label, specify the machine, and then click OK.

    Note

    Machine Transfer: If you enable this option, the job can be scheduled to a non-designated machine when all designated machines are offline.

Cron expressions

A cron expression has the following format: Seconds Minutes Hours Day-of-month Month Day-of-week [Year].

The following are some common cron expressions.

Cron expression

Description

0 */1 * * * ?

Triggers every minute.

0 0 5-15 * * ?

Triggers on the hour from 05:00 to 15:00 daily.

0 0/3 * * * ?

Triggers every 3 minutes.

0 0-5 14 * * ?

Triggers every minute from 14:00 to 14:05 daily.

0 0/5 14 * * ?

Triggers every 5 minutes from 14:00 to 14:55 daily.

0 0/5 14,18 * * ?

Triggers every 5 minutes from 14:00 to 14:55 and from 18:00 to 18:55 daily.

0 0/30 9-17 * * ?

Triggers every 30 minutes from 09:00 to 17:00 daily.

0 0 10,14,16 * * ?

Triggers at 10:00, 14:00, and 16:00 daily.

0 0 12 ? * WED

Triggers at 12:00 every Wednesday.

0 0 17 ? * TUES,THUR,SAT

Triggers at 17:00 every Tuesday, Thursday, and Saturday.

0 10,44 14 ? 3 WED

Triggers at 14:10 and 14:44 on every Wednesday in March.

0 15 10 ? * MON-FRI

Triggers at 10:15 from Monday through Friday.

0 0 23 L * ?

Triggers at 23:00 on the last day of every month.

0 15 10 L * ?

Triggers at 10:15 on the last day of every month.

0 15 10 ? * 6L

Triggers at 10:15 on the last Friday of every month.

0 15 10 * * ? 2005

Triggers at 10:15 every day in 2005.

0 15 10 ? * 6L 2002-2005

Triggers at 10:15 on the last Friday of every month from 2002 to 2005.

0 15 10 ? * 6#3

Triggers at 10:15 on the third Friday of every month.