Modified Backend files and fixed Bugs#187
Conversation
| finally: | ||
| session.close() | ||
|
|
||
| def get_file_status(self, customer_guid, filename): |
There was a problem hiding this comment.
Keep this function get_file_status
| db_manager.remove_from_common_db(customer_guid, filename, error=True) | ||
| return | ||
|
|
||
| file_record = db_manager.get_file_status(customer_guid, filename) |
There was a problem hiding this comment.
We need to keep this line else thread will exit and a new thread will take this up and this will take a long time for a file to get indexed in weaviate
file_record = db_manager.get_file_status(customer_guid, filename)
status, error_retry = file_record
| db_manager.remove_from_common_db(customer_guid, filename, error=True) | ||
| return | ||
|
|
||
| file_record = db_manager.get_file_status(customer_guid, filename) |
There was a problem hiding this comment.
We need to keep this line else thread will exit and a new thread will take this up and this will take a long time for a file to get indexed in weaviate
file_record = db_manager.get_file_status(customer_guid, filename)
status, error_retry = file_record
| try: | ||
| current_time = time.time() | ||
|
|
||
| # Vectorizer control (if needed) |
There was a problem hiding this comment.
There should be a separate thread for the whole testcase file which kills the file vectorizer process every 30 seconds
and it should not be part of this single testcase
So all testcases should have the normal flow of uploading and deleting files
For this testcase there should be separate thread which kills the file_vectorizer process every 30 seconds, irrespective of which testcase is running
The below functionality should be in a separate thread not in the place where you have kept
# Vectorizer control (if needed)
if current_time - last_control_time >= control_interval:
logger.info("Stopping file vectorizer...")
self.control_file_vectorizer()
last_control_time = current_time
May be you can edit the code and bring the file vectorizer kill for 30 seconds in the setup and teardown functions like below
class TestDeleteFileAPI(unittest.TestCase):
BASE_URL = f"http://{os.getenv('CHAT_SERVICE_HOST')}:{os.getenv('CHAT_SERVICE_PORT')}"
def setUp(self):
logger.info("=== Setting up test environment for DeleteFile API ===")
# Start the vectorizer control thread
self._stop_vectorizer_thread = threading.Event()
self._vectorizer_thread = threading.Thread(target=self._vectorizer_control_loop)
self._vectorizer_thread.daemon = True # Kills thread automatically if main program exits
self._vectorizer_thread.start()
# Setup test customer and authentication
customer_data = add_customer("test_org")
self.valid_customer_guid = customer_data["customer_guid"]
self.org_id = customer_data.get("org_id")
self.token = create_test_token(org_id=self.org_id, org_role="org:admin")
self.headers = {'Authorization': f'Bearer {self.token}'}
# Upload a test file to delete (unless it's the big lifecycle test)
if "test_full_file_lifecycle_with_realtime_monitoring" not in self._testMethodName:
self.test_filename = "test_delete_file.txt"
self._upload_test_file()
logger.info(f"=== Setup process completed for test: {self._testMethodName} ===")
def tearDown(self):
# Stop the vectorizer control thread
self._stop_vectorizer_thread.set()
self._vectorizer_thread.join(timeout=5)
logger.info(f"=== Tear down completed for test: {self._testMethodName} ===")
def _vectorizer_control_loop(self):
"""Background thread to kill vectorizer every 30 seconds."""
control_interval = 30 # seconds
while not self._stop_vectorizer_thread.is_set():
logger.info("Background thread: Stopping file vectorizer...")
self.control_file_vectorizer()
self._stop_vectorizer_thread.wait(timeout=control_interval)
1108fdf to
c6ccba4
Compare
* Modified Backend files and fixed Bugs * review comments changes * skipping uploaded files for testing * resolve the conflict in llm * fixed database manager file * Update semantic_chunk.py * update the get file status function in file vectorizer * Update file_vectorizer.py * Update file_vectorizer.py * Update file_vectorize_main.py * added singleton class testcases * Update llm_service.py * Update database_manager.py * Update database_manager.py * Update extract_file.py * Update semantic_chunk.py * Update file_vectorizer.py * Update minio_manager.py * Update weaviate_manager.py * Update chat_service.py * Update test_deletefiles.py * Update test_deletionstatus.py * Update test_singletonclass.py * Update test_deletefiles.py * Update test_singletonclass.py * Create __init__.py * Update __init__.py * Delete test/IntegrationTests/test_singletonclass.py * Delete test/IntegrationTests/__init__.py * Update test_deletefiles.py
No description provided.