Skip to content

Modified Backend files and fixed Bugs#187

Merged
Kabilan-16 merged 31 commits into
mainfrom
test_new_branch
Apr 30, 2025
Merged

Modified Backend files and fixed Bugs#187
Kabilan-16 merged 31 commits into
mainfrom
test_new_branch

Conversation

@Kabilan-16
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread build/chat_service_docker/Dockerfile
finally:
session.close()

def get_file_status(self, customer_guid, filename):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/backend/file_vectorizer_main/file_vectorize_main.py
Comment thread test/IntegrationTests/FileVectorizer/test_deletefiles.py
Comment thread test/IntegrationTests/FileVectorizer/test_deletefiles.py
Comment thread test/IntegrationTests/FileVectorizer/test_deletefiles.py
try:
current_time = time.time()

# Vectorizer control (if needed)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread test/IntegrationTests/FileVectorizer/test_deletefiles.py
@Kabilan-16 Kabilan-16 merged commit 2403f1e into main Apr 30, 2025
4 checks passed
SaravanakumarR2018 pushed a commit that referenced this pull request May 1, 2025
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants