From 2ef5c80f2d1a5b5f893c8977d8394740de6d796d Mon Sep 17 00:00:00 2001 From: Stijn Peeters Date: Tue, 3 Sep 2024 12:05:14 +0200 Subject: [PATCH] Actually check progress in text annotator --- processors/machine_learning/annotate_text.py | 29 +------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/processors/machine_learning/annotate_text.py b/processors/machine_learning/annotate_text.py index cfabbdafa..954963de4 100644 --- a/processors/machine_learning/annotate_text.py +++ b/processors/machine_learning/annotate_text.py @@ -111,33 +111,6 @@ def get_options(cls, parent_dataset=None, user=None): return options - @staticmethod - def get_progress_callback(num_items): - """ - Callback for updating dataset progress - - This generates a function that is periodically called by the service - manager to update the progress of the query. It sets the progress and - updates the dataset status. - - :param int num_prompts: Total number of prompts that will be processed. - :return: Callback - """ - - def callback(manager): - if manager.local_or_remote == "local": - current_completed = manager.count_local_files( - manager.processor.config.get("PATH_DATA").joinpath(manager.path_to_results)) - elif manager.local_or_remote == "remote": - existing_files = manager.request_folder_files(manager.server_file_collection_name) - current_completed = len(existing_files.get(manager.server_results_folder_name, [])) - - manager.processor.dataset.update_status( - f"Generated images for {current_completed:,} of {num_prompts:,} prompt(s)") - manager.processor.dataset.update_progress(current_completed / num_prompts) - - return callback - @classmethod def is_compatible_with(cls, module=None, user=None): """ @@ -218,7 +191,7 @@ def process(self): api_endpoint = "stormtrooper" try: - dmi_service_manager.send_request_and_wait_for_results(api_endpoint, data, wait_period=5, check_process=None) + dmi_service_manager.send_request_and_wait_for_results(api_endpoint, data, wait_period=5) except DsmOutOfMemory: shutil.rmtree(staging_area) shutil.rmtree(output_dir)