

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

# 監控和管理您的人工循環
<a name="a2i-monitor-humanloop-results"></a>

開始人工審核循環後，可以使用 [Amazon 增強版 AI 執行期 API](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/Welcome.html) 來檢查傳送至循環的任務結果並進行管理。此外，Amazon A2I 與 Amazon EventBridge (也稱為 Amazon CloudWatch Events) 整合，以便在人工審核循環狀態變更為 `Completed`、`Failed`、或 `Stopped` 時提醒您。至少保證一次此事件交付，這表示在人工循環完成時建立的所有事件都會成功交付至 EventBridge。

使用下列程序瞭解如何使用 Amazon A2I 執行期 API 來監控和管理人工循環。請參閱[在 Amazon 增強版 AI Amazon CloudWatch Events 中使用](a2i-cloudwatch-events.md)，瞭解 Amazon A2I 如何整合 Amazon EventBridge。

**若要檢查輸出資料：**

1. 透過呼叫 [https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_DescribeHumanLoop.html](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_DescribeHumanLoop.html) 作業來檢查人工循環的結果。此 API 作業的結果包含循環啟動的原因和結果等相關資訊。

1. 在 Amazon Simple Storage Service (Amazon S3) 中檢查人工循環中的輸出資料。在資料的路徑中，`YYYY/MM/DD/hh/mm/ss` 代表人工審查循環建立日期，包括年 (`YYYY`)、月 (`MM`) 和日 (`DD`)，以及建立時間，包括小時 (`hh`)、分鐘 (`mm`) 和秒 (`ss`)。

   ```
   s3://customer-output-bucket-specified-in-flow-definition/flow-definition-name/YYYY/MM/DD/hh/mm/ss/human-loop-name/output.json
   ```

您可以將此結構與 AWS Glue 或 Amazon Athena 整合，以分割和分析您的輸出資料。如需詳細資訊，請參閱[在 AWS Glue 中管理 ETL 輸出的分割區](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-partitions.html)。

要瞭解有關 Amazon A2I 輸出資料格式的更多資訊，請參閱[Amazon A2I 輸出資料](a2i-output-data.md)。

**若要停止並刪除您的人工循環：**

1. 人工循環開始後，您即可使用 `HumanLoopName` 透過呼叫 [https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_StopHumanLoop.html](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_StopHumanLoop.html) 作業來停止人工循環。如果成功停止人工循環，伺服器會傳回 HTTP 200 的反應。

1. 若要刪除狀態等於 `Failed`、`Completed` 或 `Stopped` 的人工循環，請使用 [https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_DeleteHumanLoop.html](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_DeleteHumanLoop.html) 作業。

**若要列出人工循環：**

1. 可以透過呼叫 [https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_ListHumanLoops.html](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_ListHumanLoops.html) 作業，列出所有作用中人工循環。您可以使用 `CreationTimeAfter` 和 `CreateTimeBefore` 參數，依照循環建立日期篩選人工循環。

1. 如果成功，`ListHumanLoops` 傳回回應元素中的 [https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_HumanLoopSummary.html](https://docs.aws.amazon.com/augmented-ai/2019-11-07/APIReference/API_HumanLoopSummary.html) 和 `NextToken` 物件。`HumanLoopSummaries` 包含單一人工循環的相關資訊。例如，它列出一個循環狀態，可以的話，還會列出失敗原因。

   使用 `NextToken` 傳回的字串做為對 `ListHumanLoops` 後續呼叫的輸入，以檢視人工循環的下一頁。