sul-dlss / speech-to-text

Tools for generating transcript and caption files from media files (e.g. a Docker container for running Whisper on video files in AWS ECS? 🤷🏽)
0 stars 0 forks source link

ExpiredToken when calling the ReceiveMessage #28

Closed edsu closed 1 month ago

edsu commented 1 month ago

When running as a daemon I think we need to run assume role again, to avoid exceptions like this that halt the container:

See: https://stackoverflow.com/a/35695573/324921

Traceback (most recent call last):
  File "/app/speech_to_text.py", line 342, in <module>
    main(daemon=args.daemon)
  File "/app/speech_to_text.py", line 24, in main
    job = get_job()
          ^^^^^^^^^
  File "/app/speech_to_text.py", line 52, in get_job
    jobs = queue.receive_messages(MaxNumberOfMessages=1, WaitTimeSeconds=10)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/boto3/resources/factory.py", line 581, in do_action
    response = action(self, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/boto3/resources/action.py", line 88, in __call__
    response = getattr(parent.meta.client, operation_name)(*args, **params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/botocore/client.py", line 569, in _api_call
    return self._make_api_call(operation_name, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/botocore/client.py", line 1023, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ExpiredToken) when calling the ReceiveMessage operation: The security token included in the request is expired