全部产品

导入导出任务

您可以在控制台上以 JSON 文件的形式对任务进行批量导入及导出。

导入导出

导出任务

操作步骤:

  1. 在任务配置页面,单击任务列表右上方的 导出 按钮。

  2. 将生成的 JSON 文件保存至本地。

说明

导出的 JSON 文件包括列表内的所有任务。

导入任务

操作步骤:

  1. 在任务配置页面,单击任务列表右上方的 导入 按钮。

  2. 在弹出的窗口中,选择 浏览 并选择本地文件。

  3. 单击 确定

示例文件

简单任务示例

{
    "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分片任务",
            "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":"既分片又分步任务",
            "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"
}

集群任务示例

{
    "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"
}