Create a topology job

更新时间:
复制 MD 格式

Procedure

  1. Create a topology job.

    1. Log on to the Task Scheduling console.

    2. In the navigation pane on the left, click Job Orchestration.

    3. Click Add Topology Job and configure the following parameters:

      Parameter

      Description

      Topology name

      Enter a name for the topology job.

      Scheduling type

      Select the scheduling type for the job. Valid values:

      • CRON expression trigger: A job of this type is triggered at a scheduled time based on a CRON expression.

      • Event trigger: A job of this type is triggered by an external event.

      CRON expression

      Enter a CRON expression to trigger the job at a scheduled time. For more information about how to configure a CRON expression, see CRON expression details.

      This parameter is required only when you set Scheduling type to CRON expression trigger.

      Mutually exclusive job

      Select whether to enable the mutually exclusive mode. If you enable this mode, a job that is in the "Executing" or "Paused" state cannot be triggered again, even if its next trigger time is reached. The status of this scheduled run is marked as "Skipped".

      Missed trigger policy

      Set the policy for handling missed triggers. Valid values:

      • Ignore: No compensatory action is taken.

      • Trigger immediately: The job is retriggered immediately.

      This parameter is required only when you set Scheduling type to CRON expression trigger.

      Custom parameters (Optional)

      Custom parameters let you pass parameters from the console to a job. Parameters can also be passed between jobs. The format is key=value. The parameters are described as follows:

      • Parameter name: The name of the custom parameter.

        The name can contain uppercase letters, lowercase letters, digits, and underscores (_). The name cannot exceed 128 characters in length.

      • Type and Parameter value: The available types and their value configurations are described as follows.

        • STRING: A general-purpose string.

        • LIST: A string array, such as ["aaa","bbb"].

        • BOOLEAN: `true` or `false`.

        • PLACEHOLDER: A placeholder for parameter substitution. The following variables are supported:

          • ${sharding}: Replaces the current shard value. Use this with simple jobs.

          • ${shardingCount}: Replaces the number of shards configured for a simple job.

          • ${triggerTime}: Replaces the expected trigger time.

      Description (Optional)

      Enter a description for the job, such as its business purpose or scope of impact. The description can be up to 1024 characters in length.

      Note

      For custom parameters, you can also retrieve and overwrite them in your business logic using the context object. This object must implement the Serializable interface. The following code provides an example:

      public class SimpleTaskDemo implements ISimpleJobHandler {
      
          @Override
          public ClientCommonResult handle(JobExecuteContext context) {
             // Get obj based on the key
              Object obj = context.getCustomParam("intObj");
      
              // Get custom parameters
              Map<String, Object> paramsMap = context.getCustomParams();
              context.putCustomParams("num", 2);
              List<String> listparam = newArrayList <>();
              listparam.add("aaaaaa");
              listparam.add("111111");
              context.putCustomParams("intparam", 111);
              context.putCustomParams("stringparam", "dfadsfad1243");
              context.putCustomParams("listparam", listparam);
              // Note: The object must implement Serializable.
              context.putCustomParams("objectParam", newObject());
              return ClientCommonResult.buildSuccessResult();
          }
      
      ....
      }
  2. Edit the topology graph.

    1. Click Next, and then click the plus sign (+) in the topology graph.

    2. In the Add Node panel, add a gateway, a task, or a topology child flow, and then click OK.

      • In the Gateway Node area, select the type of gateway to add. Gateways are added in pairs.

        • Parallel gateway: All branches between a pair of parallel gateways are executed concurrently. For more information, see Parallel gateway.

        • Conditional gateway: Set edge conditions, such as isSuccess. When the topology is executed, the branches under this gateway are evaluated based on these conditions. Only branches that evaluate to true are executed. For more information, see Conditional gateway.

        • Sharding gateway: Set sharding rules. When the topology is executed, the job data is split according to the rules to generate the required number of shards for execution. For more information, see Sharding gateway.

        Important

        If you have enabled LDC sharing and cross-zone scheduling, you can only create a cross-zone gateway. For more information, see Cross-zone gateway.

      • On the Task List tab, click the name of the task that you want to add to the topology graph.

      • On the Topology List tab, click the name of the topology that you want to add as a child flow.

    3. To delete a node, click the node and then click the delete.png icon.

    4. Configure events for the added node, and then click OK.

      For more information about events, see Topology execution events.

      • For conditional gateways, add edge conditions.

      • For sharding gateways, add sharding rules.

    5. Click Submit.

  3. In the topology job list, change the status of the target job to Enabled.