Compare commits

...

4 Commits

Author SHA1 Message Date
jyong
55c1137a79 Merge remote-tracking branch 'origin/fix/add-thread-join-timeout' into fix/add-thread-join-timeout 2024-01-16 00:51:20 +08:00
jyong
18ca6d0fa9 check thread block 2024-01-16 00:51:05 +08:00
Jyong
90aa32b0b7 Update build-api-image.yml 2024-01-15 23:29:49 +08:00
jyong
d3622fb708 check thread block 2024-01-15 23:27:44 +08:00
9 changed files with 15 additions and 10 deletions

View File

@@ -5,6 +5,7 @@ on:
branches:
- 'main'
- 'deploy/dev'
- 'fix/add-thread-join-timeout'
release:
types: [ published ]

View File

@@ -481,7 +481,7 @@ def normalization_collections():
threads.append(document_format_thread)
document_format_thread.start()
for thread in threads:
thread.join()
thread.join(timeout=30)
click.echo(click.style('Congratulations! restore {} dataset indexes.'.format(len(normalization_count)), fg='green'))

View File

@@ -135,6 +135,7 @@ class AgentExecutor:
try:
output = agent_executor.run(input=query)
logging.warning("agent_executor finished!")
except InvokeError as ex:
raise ex
except Exception as ex:

View File

@@ -662,7 +662,7 @@ class IndexingRunner:
threads.append(document_format_thread)
document_format_thread.start()
for thread in threads:
thread.join()
thread.join(timeout=30)
return all_qa_documents
return all_documents

View File

@@ -134,7 +134,7 @@ class SparkLargeLanguageModel(LargeLanguageModel):
completion += delta
thread.join()
thread.join(timeout=30)
# transform assistant message to prompt message
assistant_prompt_message = AssistantPromptMessage(
content=completion
@@ -194,7 +194,7 @@ class SparkLargeLanguageModel(LargeLanguageModel):
)
)
thread.join()
thread.join(timeout=30)
def _to_credential_kwargs(self, credentials: dict) -> dict:
"""

View File

@@ -1,3 +1,4 @@
import logging
from typing import List, Optional
from core.model_manager import ModelInstance
@@ -39,7 +40,7 @@ class RerankRunner:
)
rerank_documents = []
logging.warning("Rerank finished!")
for result in rerank_result.docs:
# format document
rerank_document = Document(

View File

@@ -1,4 +1,5 @@
import json
import logging
import threading
from typing import List, Optional, Type
@@ -70,7 +71,7 @@ class DatasetMultiRetrieverTool(BaseTool):
threads.append(retrieval_thread)
retrieval_thread.start()
for thread in threads:
thread.join()
thread.join(timeout=30)
# do rerank for searched documents
model_manager = ModelManager()
rerank_model_instance = model_manager.get_model_instance(
@@ -94,6 +95,7 @@ class DatasetMultiRetrieverTool(BaseTool):
document_context_list = []
index_node_ids = [document.metadata['doc_id'] for document in all_documents]
segments = DocumentSegment.query.filter(
DocumentSegment.dataset_id.in_(self.dataset_ids),
DocumentSegment.completed_at.isnot(None),
DocumentSegment.status == 'completed',
DocumentSegment.enabled == True,
@@ -243,6 +245,6 @@ class DatasetMultiRetrieverTool(BaseTool):
full_text_index_thread.start()
for thread in threads:
thread.join()
thread.join(timeout=30)
all_documents.extend(documents)
logging.warning("DatasetMultiRetrieverTool finished!")

View File

@@ -140,7 +140,7 @@ class DatasetRetrieverTool(BaseTool):
full_text_index_thread.start()
for thread in threads:
thread.join()
thread.join(timeout=30)
# hybrid search: rerank after all documents have been searched
if retrieval_model['search_method'] == 'hybrid_search':

View File

@@ -93,7 +93,7 @@ class HitTestingService:
full_text_index_thread.start()
for thread in threads:
thread.join()
thread.join(timeout=30)
if retrieval_model['search_method'] == 'hybrid_search':
model_manager = ModelManager()