Manage simple tasks and cluster tasks

更新时间:
复制 MD 格式

The task list provides an overview of all tasks in the current environment.

View tasks

View the task list

  1. Log on to the Scalable Open Financial Architecture Stack (SOFAStack) console.

  2. In the left-side navigation pane, choose Middleware > Task Scheduling > Task Configuration.

    In the task list that appears, you can view the information about each created scheduled task, such as the task name, corresponding application, and priority.mv

View subscription nodes

  1. In the task list, click the name of the target task.

  2. Click the Client tab.

    On this tab, you can view the IP address, version, and execution records of each subscribed client. You can also click Trigger Now to trigger the task on the client.mv

View scheduling records

Currently, you can view only the scheduling records of tasks whose communication mode is Callback, execution details of data chunks of cluster tasks, and client logs.

  1. In the task list, click the name of the target task.

  2. Click the Scheduling Record tab.

    On this tab, you can view the following information:

    • Request ID: the request ID, which is used for troubleshooting.

    • Trigger Status: the trigger status of the task. The trigger may succeed, fail, or be missed.

    • Reason for Trigger: the mode in which the task is triggered. Valid values: Manual Trigger, Timing trigger, Event-based Trigger, and Topology Trigger.

    • Start Time: the time when the task execution starts.

    • End Time: the time when the task execution ends.

    • Time Consumed: the amount of time consumed by the request, in seconds.

    • Client: the IP address of the subscription node.

    • Execution Status: the execution status. The task execution may succeed, fail, or be in another state.

    • Context: the trigger context and execution context.

    版本号

Group tasks

You can group tasks based on the business logic.

  1. In the SOFAStack console, choose Middleware > Task Scheduling > Task group in the left-side navigation pane.

  2. Click Add group. In the dialog box that appears, set the Group name and Description parameters.

  3. Click Add Tasks in Batches on the right side of the created group.

  4. Select the target tasks and click Add Selected Items in Batches.

Export and import tasks

You can import and export multiple tasks at a time in the form of a JSON file in the console. This way, you can manage offline and online configurations or configurations in different environments in a unified manner.

Export tasks

  1. In the SOFAStack console, choose Middleware > Task Scheduling > Task Configuration in the left-side navigation pane.

  2. Select the target tasks in the task list and click Export in the upper-right corner.

    The tasks are exported as a JSON file and the file is stored in the default download path specified by the browser.

Import tasks

  1. In the SOFAStack console, choose Middleware > Task Scheduling > Task Configuration in the left-side navigation pane.

  2. Click Import in the upper-right corner and then click Browse.

  3. Select the target file and click Open.

  4. Click OK.

Sample task files

  • Simple task

    {
        "file":[
                 {
                    "app":"schedulertutorial",
                    "context":{},
                    "cron":"0 0/5 * * * ?",
                    "failHandleStrategy":"THREE_TIMES",
                    "handlers":[
                    "stepOne",
                    "stepTwo"],
                    "invokeType":"CALLBACK",
                    "name":"stepTest",
                    "routeStrategy":"RANDOM",
                    "shardingCount":1,
                    "timeUnit":"MINUTES",
                    "timeout":1,
                    "triggerType":"CRON",
                    "type":"SIMPLE"
                 },
                {
                "app":"watchmen",
                "context":{
                    "customParam":{
                    "k1":"test1",
                    "k2":"test2",
                    "k3":"test3"}
                },
                "cron":"0 0 0 * * ? *",
                "des":"callback split task",
                "failHandleStrategy":"NO_RETRY",
                "handlers":["CALLBACK_SHARDS_JOB"],
                "invokeType":"CALLBACK",
                "name":"CALLBACK_SHARDS_JOB",
                "routeStrategy":"RANDOM",
                "shardingCount":3,
                "timeUnit":"SECONDS",
                "timeout":10,
                "triggerType":"CRON",
                "type":"SIMPLE"
            },
            {
                "app":"watchmen",
                "context":{
                    "customParam":{
                    "k1":"v1",
                    "k2":"v2"}
                 },
                "cron":"0 0 0 * * ? *",
                "des":"Split the task data and divide the task into steps.",
                "failHandleStrategy":"THREE_TIMES",
                "handlers":[
                    "WATCHMEN_CALLBACK_RETRY_THREE_TIMES_JOB",
                    "CALLBACK_SHARDS_JOB"
                ],
                "invokeType":"CALLBACK",
                "name":"CALLBACK_SHARDS_AND_STEPS_JOB",
                "routeStrategy":"RANDOM",
                "shardingCount":2,
                "timeUnit":"SECONDS",
                "timeout":10,
                "triggerType":"CRON",
                "type":"SIMPLE"
            },
        ],
        "triggerMode":"RPC"
    }
  • Cluster task

    {
        "file":[
            {
                "app":"schedulertutorial",
                "context":{},
                "des":"",
                "failHandleStrategy":"NO_RETRY",
                "handlers":[
                    "ANTSCHEDULER_CLUSTER_FIRST_SPLITOR",
                    "ANTSCHEDULER_CLUSTER_SECOND_SPLITOR",
                    "ANTSCHEDULER_CLUSTER_EXECUTOR"
                ],
                "invokeType":"CALLBACK",
                "name":"testCluster",
                "routeStrategy":"RANDOM",
                "shardingCount":1,
                "timeUnit":"MINUTES",
                "timeout":5,
                "triggerType":"EVENT",
                "type":"CLUSTER"
            }
        ],
        "triggerMode":"RPC"
    }

Adjust the status of cells

On the Task Configuration page, you can view the total number of cells configured for each task and the number of enabled cells. You can also adjust the status of each cell as required.

Note

This feature applies only to environments that support the LDC-based architecture.

  1. In the SOFAStack console, choose Middleware > Task Scheduling > Task Configuration in the left-side navigation pane.

  2. Go to the cell setting page.

    You can go to the cell setting page in one of the following ways:

    • In the task list on the Task Configuration page, click the pencil icon in the Cell column of the target task.编辑

    • On the details page of the task, click Adjust Cell Status on the Cell tab.调整

  3. In the Adjust Cell Status dialog box, select one or more cells to be enabled for the task and click OK.mv