Simulating upcoming events and tuning your schedule
Before associating, that is to say, applying your schedule to a task, simulate events that this schedule could trigger in the future and then tune the schedule accordingly.Before you begin
- Generate an access token:
- For users, generate a personal access token. For further information, see Generating a Personal Access Token.
- For service accounts, generate a service account token. For further information about how to generate a service account token, see Generating a service account token. 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
.
-
You must know the ID of the schedule for which you need to simulate events.
-
To simulate upcoming events, ensure that the user or the service account to be used to issue API calls has the
VIEW
permission for at least one workspace in the environment in which you need to simulate and tune schedules.If the schedule to be tuned has been associated to a task or a plan, the
VIEW
permission for the workspace to which this task or plan belongs is required. -
To tune your schedule, that is to say, update triggers defined for that schedule, the user or the service account to be used must have the
TMC_OPERATOR
role and theEXECUTOR
permission for at least one workspace in the environment in which you need to create the schedule.If the schedule to be tuned has been associated to a task or a plan, the
EXECUTOR
permission for the workspace to which this task or plan belongs is required.
Procedure
-
Issue the following request to simulate the upcoming events to be triggered by your schedule.
method: GET endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>/events headers: { "Content-Type": "application/json", "Authorization": "Bearer <your_personal_access_token_or_service_account_token>" } payload: { "to": "1742567692000" }
The
to
field is used to specify the end date time in milliseconds of the period for which you simulate upcoming events.In the response, each upcoming event is returned with the trigger that sets it off so that you can easily identify the trigger you need to update for this schedule.
[ { "date": "2022-06-22T10:04:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-22T10:09:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-23T10:04:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-23T10:09:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-24T10:04:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-24T10:09:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-25T10:04:00.000Z", "sourceTriggerName": "my_trigger_1" }, { "date": "2022-06-25T10:09:00.000Z", "sourceTriggerName": "my_trigger_1" } ]
For example, if you discover that an event will be triggered during the maintenance time of your system, you may need to update the trigger to start that event earlier or later.
-
Issue the following API call to update triggers of a schedule:
method: PUT endpoint: https://api.<env>.cloud.talend.com/orchestration/schedules/<scheduleId>/triggers headers: { "Content-Type": "application/json", "Authorization": "Bearer <your_personal_access_token_or_service_account_token>" } payload: { "Trigger": { "name": "My unique trigger name", "startDate": "2022-06-17", "timeZone": "Europe/Kiev", "type": "ONCE", atTimes: { "type": "AT_TIME", "time": "11:00" } } }
This request updates the trigger with the name My unique trigger name by changing the event start date to 2022-06-17 (June 17, 2022). The other triggers defined for this schedule stay unchanged.
The same requirements about defining a new trigger apply on the trigger updates. When you send the request, an automatic check proceeds.
Results
Your schedule is now fine-tuned to start events at the most appropriate times.
It is ready to be associated to a task so as to trigger events for this task as scheduled.