检查转录作业状态

时间:2018-06-11 09:15:24

标签: c# .net amazon-web-services aws-transcribe

当我尝试获取转录结果时,我遇到了 Amazon Transcribe 的例外情况。 我没有找到一种方法来传递回调或在转录完成时收到通知。所以我会定期检查结果是否可用。

这是我的代码:

var getTranscriptionJobRequest = new GetTranscriptionJobRequest()
{
    TranscriptionJobName = fileName
};

// Regularly check the request status
GetTranscriptionJobResponse getTranscriptionJobResponse;
do
{
  Thread.Sleep(250); // Wait 250 ms
  getTranscriptionJobResponse = amazonTSClient.GetTranscriptionJob(getTranscriptionJobRequest);
}
while (getTranscriptionJobResponse.TranscriptionJob.TranscriptionJobStatus != TranscriptionJobStatus.COMPLETED);

以下是例外:

Amazon.TranscribeService.AmazonTranscribeServiceException: 'Rate exceeded'

我发现here错误是由于对AWS API的请求太多。

所以,我的问题是:

转录结果可用时是否可以收到通知? 如果不是,AWS API的最大通话费率是多少?

1 个答案:

答案 0 :(得分:0)

AWS Transcribe的通知依赖于它与AWS CloudWatch的集成。云监视规则示例:

{
  "source": [
    "aws.transcribe"
  ],
  "detail-type": [
    "Transcribe Job State Change"
  ],
  "detail": {
    "TranscriptionJobStatus": [
      "COMPLETED",
      "FAILED"
    ]
  }
}

CloudWatch中的结果事件:

 {
   "version": "0",
   "id": "event ID",
   "detail-type":"Transcribe Job State Change",
   "source": "aws.transcribe",
   "account": "account ID",
   "time": "timestamp",
   "region": "region",
   "resources": [],
   "detail": {
     "TranscriptionJobName": "unique job name",
     "TranscriptionJobStatus": "status"
   }
 }

更多信息:

如果改为轮询,则GetTranscriptionJob的最大呼叫速率为每秒约3个。该速率限制和其他速率限制在此处记录: