1

I hava a AWS Lambda function written in Java. This function starts a TranscriptionJob and then wait for the response like so:

while( true ){
    transcriptionJob = awsClient.getTranscriptionJob(getJobRequest).getTranscriptionJob();
    if( transcriptionJob.getTranscriptionJobStatus().equals(TranscriptionJobStatus.COMPLETED.name()) ){
        System.out.println("AWS transcribe completed with " + transcriptionJob.getMedia().getMediaFileUri());
        Date comleption = transcriptionJob.getCompletionTime();
        // duration until response in seconds 
        long duration = (comleption.getTime()-awsTranscribeStart.getTime())/1000;
        logger.log("AWS transcribe took " + duration + " seconds\n");
        break;
    }else if( transcriptionJob.getTranscriptionJobStatus().equals(TranscriptionJobStatus.FAILED.name()) ){
        System.out.println("AWS transcribe failed: " + transcriptionJob.getFailureReason());
        break;
    }
    System.out.println("Waiting for response...");
    try {
        Thread.sleep(10000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

For my longer audio files, a transcription job takes up to 10 minutes to be completed but a Lambda function is limited to 5 minutes. There is no "Transcription job completed event" or something similiar(yet).

Is there a workaround for this problem or do I have to switch from AWS Lambda to something else?

Sip
  • 373
  • 1
  • 6
  • 22
  • 1
    It looks like the TranscriptFileUri in the eventual response points at a bucket that AWS Transcribe owns, rather than you own, so you can't trigger Lambda from the JSON response file being uploaded there. So, a couple of options would be to run a 2nd Lambda on a schedule that simply queries the job state for completion and then initiates your next action. Or, better still, you could build this simple workflow using Step Functions. – jarmod May 04 '18 at 17:42
  • Thanks for the input. I will try step functions and update my results here. – Sip May 07 '18 at 07:07
  • You can use step functions to orchestrate a longer running workflow or compose lambda functions together, – Steve Severance May 30 '18 at 23:08

1 Answers1

2

I created a workaround using Step Functions.

enter image description here

There is another thread about this issue on the aws forum.

Sip
  • 373
  • 1
  • 6
  • 22