def process_new_task(self, images, name=None, options=[], progress_callback=None): """ Sends a set of images (and optional GCP file) via the API to start processing. :param images: list of path images :param name: name of the task :param options: options to be used for processing ([{'name': optionName, 'value': optionValue}, ...]) :param progress_callback: optional callback invoked during the upload images process to be used to report status. :returns UUID of the newly created task """ if len(images) < 2: raise exceptions.NodeServerError("Need at least 2 images") api_client = self.api_client() opts = self.options_list_to_dict(options) task = api_client.create_task(images, opts, name, progress_callback) return task.uuid
def process_new_task(self, images, name=None, options=[], progress_callback=None): """ Sends a set of images (and optional GCP file) via the API to start processing. :param images: list of path images :param name: name of the task :param options: options to be used for processing ([{'name': optionName, 'value': optionValue}, ...]) :param progress_callback: optional callback invoked during the upload images process to be used to report status. :returns UUID of the newly created task """ if len(images) < 2: raise exceptions.NodeServerError("Need at least 2 images") api_client = self.api_client() opts = self.options_list_to_dict(options) if not settings.TESTING: task = api_client.create_task(images, opts, name, progress_callback) else: # The create_task function uses multi-threaded parallel uploads # but Django tests cannot cope with DB updates from different threads # (and progress_callback often updates the DB). So during testing # we use the fallback function equivalent which is single-threaded task = api_client.create_task_fallback(images, opts, name, progress_callback) return task.uuid