排程 - AWS Data Pipeline

AWS Data Pipeline 不再提供給新客戶。的現有客戶 AWS Data Pipeline 可繼續正常使用此服務。進一步了解

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

排程

定義排程事件的時間,例如當活動執行時。

注意

當排程的開始時間已經過去時,會 AWS Data Pipeline 回填管線,並從指定的開始時間開始立即開始排程執行。針對測試/開發,請使用相對較短的間隔。否則,會 AWS Data Pipeline 嘗試在該間隔內將管線的所有執行排入佇列和排程。 AWS Data Pipeline 如果管線元件早於 1 天前,藉scheduledStartTime由封鎖管線啟動,嘗試防止意外回填。

範例

以下為此物件類型的範例。它會定義每小時的排程,從 2012-09-01 的 00:00:00 小時開始,至 2012-10-01 的 00:00:00 小時結束。第一個期間會在 2012-09-01 的 01:00:00 結束。

{ "id" : "Hourly", "type" : "Schedule", "period" : "1 hours", "startDateTime" : "2012-09-01T00:00:00", "endDateTime" : "2012-10-01T00:00:00" }

以下管道會在 FIRST_ACTIVATION_DATE_TIME 時啟動,每個小時執行一次,直到 2014-04-25 的 22:00:00 小時為止。

{ "id": "SchedulePeriod", "name": "SchedulePeriod", "startAt": "FIRST_ACTIVATION_DATE_TIME", "period": "1 hours", "type": "Schedule", "endDateTime": "2014-04-25T22:00:00" }

以下管道會在 FIRST_ACTIVATION_DATE_TIME 時啟動,每小時執行一次,並在執行三次後完成。

{ "id": "SchedulePeriod", "name": "SchedulePeriod", "startAt": "FIRST_ACTIVATION_DATE_TIME", "period": "1 hours", "type": "Schedule", "occurrences": "3" }

以下管道會在 2014-04-25 的 22:00:00 時啟動,每小時執行一次,並在執行三次後結束。

{ "id": "SchedulePeriod", "name": "SchedulePeriod", "startDateTime": "2014-04-25T22:00:00", "period": "1 hours", "type": "Schedule", "occurrences": "3" }

使用 Default 物件的隨需

{ "name": "Default", "resourceRole": "DataPipelineDefaultResourceRole", "role": "DataPipelineDefaultRole", "scheduleType": "ondemand" }

使用明確 Schedule 物件的隨需

{ "name": "Default", "resourceRole": "DataPipelineDefaultResourceRole", "role": "DataPipelineDefaultRole", "scheduleType": "ondemand" }, { "name": "DefaultSchedule", "type": "Schedule", "id": "DefaultSchedule", "period": "ONDEMAND_PERIOD", "startAt": "ONDEMAND_ACTIVATION_TIME" },

下列範例會示範如何從預設物件繼承 Schedule,針對該物件明確設定,或是由父參考明確給予。

從 Default 物件繼承的 Schedule

{ "objects": [ { "id": "Default", "failureAndRerunMode":"cascade", "resourceRole": "DataPipelineDefaultResourceRole", "role": "DataPipelineDefaultRole", "pipelineLogUri": "s3://myLogsbucket", "scheduleType": "cron", "schedule": { "ref": "DefaultSchedule" } }, { "type": "Schedule", "id": "DefaultSchedule", "occurrences": "1", "period": "1 Day", "startAt": "FIRST_ACTIVATION_DATE_TIME" }, { "id": "A_Fresh_NewEC2Instance", "type": "Ec2Resource", "terminateAfter": "1 Hour" }, { "id": "ShellCommandActivity_HelloWorld", "runsOn": { "ref": "A_Fresh_NewEC2Instance" }, "type": "ShellCommandActivity", "command": "echo 'Hello World!'" } ] }

物件上的明確排程

{ "objects": [ { "id": "Default", "failureAndRerunMode":"cascade", "resourceRole": "DataPipelineDefaultResourceRole", "role": "DataPipelineDefaultRole", "pipelineLogUri": "s3://myLogsbucket", "scheduleType": "cron" }, { "type": "Schedule", "id": "DefaultSchedule", "occurrences": "1", "period": "1 Day", "startAt": "FIRST_ACTIVATION_DATE_TIME" }, { "id": "A_Fresh_NewEC2Instance", "type": "Ec2Resource", "terminateAfter": "1 Hour" }, { "id": "ShellCommandActivity_HelloWorld", "runsOn": { "ref": "A_Fresh_NewEC2Instance" }, "schedule": { "ref": "DefaultSchedule" }, "type": "ShellCommandActivity", "command": "echo 'Hello World!'" } ] }

來自父參考的排程

{ "objects": [ { "id": "Default", "failureAndRerunMode":"cascade", "resourceRole": "DataPipelineDefaultResourceRole", "role": "DataPipelineDefaultRole", "pipelineLogUri": "s3://myLogsbucket", "scheduleType": "cron" }, { "id": "parent1", "schedule": { "ref": "DefaultSchedule" } }, { "type": "Schedule", "id": "DefaultSchedule", "occurrences": "1", "period": "1 Day", "startAt": "FIRST_ACTIVATION_DATE_TIME" }, { "id": "A_Fresh_NewEC2Instance", "type": "Ec2Resource", "terminateAfter": "1 Hour" }, { "id": "ShellCommandActivity_HelloWorld", "runsOn": { "ref": "A_Fresh_NewEC2Instance" }, "parent": { "ref": "parent1" }, "type": "ShellCommandActivity", "command": "echo 'Hello World!'" } ] }

語法

必要欄位 描述 槽類型
period 管道應有的執行頻率。格式為 "N [minutes|hours|days|weeks|months]",其中 N 是數字,後接其中一個時間指定元。例如 "15 minutes",表示每 15 分鐘執行一次管道。最短期間為 15 分鐘,而最長期間為 3 年。 期間

必要的群組 (下列其中之一為必要) 描述 槽類型
startAt 開始執行排程管道的日期和時間。有效值為 FIRST _ ACTIVATION _ DATE _TIME,已過時支持建立隨選管線。 列舉
startDateTime 開始執行排程的日期和時間。您必須使用 startDateTime 或 startAt 但不能同時使用兩者。 DateTime

選用欄位 描述 槽類型
endDateTime 結束執行排程的日期和時間。必須是晚於 startDateTime 或值的日期和時間startAt。預設行為是排程執行直到管道關閉為止。 DateTime
occurrences 啟動管道之後的管道執行次數。您無法搭配使用出現次數 endDateTime。 Integer
parent 目前物件的父系,其插槽會被繼承。 引用對象,例如「父」:{「ref」:「myBaseObjectID」}

執行時間欄位 描述 槽類型
@version 建立物件使用的管道版本。 字串

系統欄位 描述 槽類型
@error 描述格式錯誤物件的錯誤 字串
@firstActivationTime 建立物件的時間。 DateTime
@pipelineId 此物件所屬管道的 ID 字串
@sphere 物件範圍代表其在生命週期中的位置:Component 物件會引發執行 Attempt 物件的 Instance 物件 字串