Skip to main content Skip to complementary content

Upgrading a single-triggered task to be multi-triggered

Upgrade your duplicated single-triggered tasks to one single task with multiple triggers.

You may have duplicated a task for each of the triggers you need to use for this task. You do not need to do this anymore. You can now directly define these triggers for a schedule and apply that schedule to this task.

Information noteNote: When you edit the schedule of a single-triggered task in the UI, this task is converted to multi-triggered. Once done, you need to use GET /executables/tasks/{taskId}/schedule endpoint to get task schedule details.

Before you begin

  • Generate access tokens:

    Once generated, a service account token expires after 30 minutes. If it expires, generate a new token using the POST method at the endpoint https://api.<env>.cloud.talend.com/security/oauth/token. For more information about generating a token, see Generating a service account token.

  • You must know the ID of the task you need to associate the schedule.
    In Talend Management Console, this ID is displayed on the dedicated page of this task. For example:
    The task ID on the page of the task.
    Or you can obtain task IDs via the following API request:
    method: GET
    endpoint: https://api.<env>.cloud.talend.com/processing/executables/tasks
    headers: {
              "Content-Type": "application/json",
              "Authorization": "Bearer <your_personal_or_service_account_access_token>"
              }
    query parameters: {
              "workspaceId": "id_of_the_workspace_of_the_task_to_be_updated"
                      }
  • Ensure that the user or the service account to be used have the TMC_OPERATOR role and the EXECUTOR permission for the workspace to which the task to be updated belongs.

Procedure

  1. Get existing triggers of the task instances that you need to upgrade to be one single multi-triggered task. To do this, issue the following API request for each of the task instances.

    Example

    method: GET
    endpoint: https://api.<env>.cloud.talend.com/orchestration/executables/tasks/<taskId>/run-config
    headers: {
              "Content-Type": "application/json",
              "Authorization": "Bearer <your_personal_or_service_account_access_token>"
              }
    payload: N/A
    In the response, you can find the trigger defined for this task, for example:
    "trigger": {
        "type": "ONCE",
        "interval": 1,
        "startDate": "2019-09-25",
        "timeZone": "Europe/London",
        "atTimes": {
          "type": "AT_TIME",
          "times": [
            "10:00"
          ],
          "time": "10:00",
          "startTime": "10:00",
          "endTime": "23:00",
          "interval": "10"
        },
        "atDays": {
          "type": "DAY_OF_WEEK",
          "day": 3,
          "days": [
            "MONDAY",
            "WEDNESDAY",
            "FRIDAY"
          ]
        }
    Note that a webhook trigger is not supported by a schedule. Therefore, if a task instance is using a webhook trigger, you need to keep it as is.
  2. Create a new schedule and paste the entire objects of these triggers you got from the previous step in this schedule.
  3. Added a name field to each of these triggers.

    Example

    The example above could now read like:
    "trigger": {
        "name": "My unique once trigger"
        "type": "ONCE",
        "interval": 1,
        "startDate": "2019-09-25",
        "timeZone": "Europe/London",
        "atTimes": {
          "type": "AT_TIME",
          "times": [
            "10:00"
          ],
          "time": "10:00",
          "startTime": "10:00",
          "endTime": "23:00",
          "interval": "10"
        },
        "atDays": {
          "type": "DAY_OF_WEEK",
          "day": 3,
          "days": [
            "MONDAY",
            "WEDNESDAY",
            "FRIDAY"
          ]
        }
  4. Simulate upcoming events to be triggered by that schedule and assign this schedule to your task. For further information about the whole procedure, see Using a schedule to organize your task runs.

    This task could be a new instance duplicated from the above-mentioned task instances or simply one of those task instances. This new schedule and its triggers replace any existing triggers of the target task.

  5. Remove all duplicate tasks since they are not useful anymore.

Results

Once done, your task contains all the time triggers that once needed to be added each for a duplicated instance of the task.

You can issue a GET request to https://api.<env>.cloud.talend.com/orchestration/executables/tasks/<taskId>/run-config to check the response. In the Trigger object, the type field now displays MULTIPLE.
{
  "trigger": {
    "type": "MULTIPLE"
  },
  "runtime": {
    "type": "CLOUD"
  },
  "parallelExecutionAllowed": false,
  "logLevel": "WARN"
}

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!