Skip to content

Commit 0aa8429

Browse files
committed
fixed a bug in the opensearch auth
1 parent 281fb8c commit 0aa8429

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

slow_tasks.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
credentials = boto3.Session().get_credentials()
1515
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, AWS_REGION, service, session_token=credentials.token)
1616

17-
search = OpenSearch(
18-
hosts = [{'host': OPENSEARCH_HOST, 'port': 443}],
19-
http_auth = awsauth,
20-
use_ssl = True,
21-
verify_certs = True,
22-
connection_class = RequestsHttpConnection
23-
)
17+
2418

2519
device = "cuda" if torch.cuda.is_available() else "cpu"
2620

@@ -52,6 +46,14 @@ def process_audio_stream(
5246
print(f'from realtime: {transcription_from_realtime}')
5347
print(f'whisper large: {transcription}')
5448

49+
search = OpenSearch(
50+
hosts = [{'host': OPENSEARCH_HOST, 'port': 443}],
51+
http_auth = awsauth,
52+
use_ssl = True,
53+
verify_certs = True,
54+
connection_class = RequestsHttpConnection
55+
)
56+
5557
document = {
5658
'timestamp': datetime.utcfromtimestamp(timestamp).isoformat(),
5759
'bucket': bucket,

0 commit comments

Comments
 (0)