All Products
Search
Document Center

ACS__TimerTrigger

Last Updated: Jun 11, 2020

Features

The ACS::TimerTrigger action can be used to perform O&M operations at scheduled time points. After an execution is started, Operation Orchestration Service (OOS) sets the execution to the Waiting status until the specified time point arrives. After the task is completed, the execution enters the Waiting status again.

Restrictions

The trigger actions have the following restrictions:

  • Only one trigger action is allowed for one template.

  • The trigger action must be defined as the first action.

  • The trigger action is not allowed for an embedded template.

Syntax

  • YAML format
  1. Tasks:
  2. - Name: timerTask # The name of the task.
  3. Action: ACS::TimerTrigger
  4. Properties:
  5. Type: cron # Required. The type of the time, which is recorded in a cron or rate expression. rate or cron or at type is optional.
  6. Expression: '0 * * ? * *' # Required. The expression of the time, which is recorded in a cron or datetime or rate expression.
  7. TimeZone: 'Asia/Shanghai'
  8. EndDate: 2020-06-01T00:00:00Z # Required. The end time in the YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format. The time must be in Coordinated Universal Time (UTC).
  • JSON format (For more information, see the parameter description for the YAML format.)
  1. {
  2. "Tasks": [
  3. {
  4. "Name": "timerTask",
  5. "Action": "ACS::TimerTrigger",
  6. "Properties": {
  7. "Type": "cron",
  8. "Expression": "0 * * ? * *",
  9. "EndDate": "2020-06-01T00:00:00.000Z",
  10. "TimeZone": "Asia/Shanghai"
  11. }
  12. }
  13. ]
  14. }

Flow chart

oos

Description

  • After you create an execution, the parent execution enters the Waiting status.
  • When the specified time point arrives, the parent execution enters the Running status. At the same time, the parent execution automatically creates a child execution. The child execution uses the same template and parameters, but skips the trigger action to directly perform the subsequent tasks.
  • After the child execution enters a final status, such as Success, Failed, or Cancelled, the parent execution enters the Waiting status again. When the next specified time point arrives, the parent execution repeats the previous steps until the specified end time arrives.
  • When the end time arrives, the parent execution is completed. The status of the parent execution changes from Waiting to Success.
  • You can cancel a parent or child execution like canceling a common execution. A canceled execution enters the Cancelled status.

Example

The following template is used to start a specified instance at a specified time point:

cron type:

  • YAML format
  1. ---
  2. FormatVersion: OOS-2019-06-01
  3. Description: Schedule to reboot ECS instances.
  4. Tasks:
  5. - Name: timer
  6. Action: ACS::TimerTrigger
  7. Properties:
  8. Type: cron
  9. Expression: 5 minute
  10. EndDate: 2020-12-20T00:00:00Z
  11. - Name: rebootInstance
  12. Action: ACS::ECS::RebootInstance
  13. Properties:
  14. InstanceId: "i-xxxxx"
  • JSON format
  1. {
  2. "FormatVersion": "OOS-2019-06-01",
  3. "Description": "Schedule to reboot ECS instances.",
  4. "Tasks": [
  5. {
  6. "Name": "timer",
  7. "Action": "ACS::TimerTrigger",
  8. "Properties": {
  9. "Type": "cron",
  10. "Expression": "5 minute",
  11. "EndDate": "2020-12-20 00:00:00 UTC"
  12. }
  13. },
  14. {
  15. "Name": "rebootInstance",
  16. "Action": "ACS::ECS::RebootInstance",
  17. "Properties": {
  18. "InstanceId": "i-xxxxx"
  19. }
  20. }
  21. ]
  22. }

at type:

  • YAML:
  1. ---
  2. FormatVersion: OOS-2019-06-01
  3. Description: Schedule to reboot ECS instances.
  4. Tasks:
  5. - Name: timer
  6. Action: ACS::TimerTrigger
  7. Properties:
  8. Type: at
  9. Expression: '2020-02-29T09:17:35Z'
  10. EndDate: 2020-12-20T00:00:00Z
  11. - Name: rebootInstance
  12. Action: ACS::ECS::RebootInstance
  13. Properties:
  14. InstanceId: "i-xxxxx"
  • JSON:
  1. {
  2. "FormatVersion": "OOS-2019-06-01",
  3. "Description": "Schedule to reboot ECS instances.",
  4. "Tasks": [
  5. {
  6. "Name": "timer",
  7. "Action": "ACS::TimerTrigger",
  8. "Properties": {
  9. "Type": "at",
  10. "Expression": "2020-02-29T09:17:35Z",
  11. "EndDate": "2020-12-20T00:00:00.000Z"
  12. }
  13. },
  14. {
  15. "Name": "rebootInstance",
  16. "Action": "ACS::ECS::RebootInstance",
  17. "Properties": {
  18. "InstanceId": "i-xxxxx"
  19. }
  20. }
  21. ]
  22. }