From 6390144e2b03a0a651c83eb69944e80be4d9a2a8 Mon Sep 17 00:00:00 2001 From: Christopher Rhodes <christopher.rhodes@embl.de> Date: Tue, 26 Nov 2024 15:30:20 +0100 Subject: [PATCH] Filelist is reindexed after resolving multiposition files --- model_server/clients/batch_runner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/model_server/clients/batch_runner.py b/model_server/clients/batch_runner.py index f79322be..3d1d9ae6 100644 --- a/model_server/clients/batch_runner.py +++ b/model_server/clients/batch_runner.py @@ -120,6 +120,8 @@ class FileBatchRunnerClient(HttpClient): df = pd.DataFrame(paths).head(min(max_count, len(paths))) else: df = pd.DataFrame(paths) + if len(df) == 0: + raise EmptyFileListError('No files were found') df['exists'] = df['path'].apply(lambda x: x.exists()) df['parent'] = df['path'].apply(lambda x: x.parent) df['filename'] = df['path'].apply(lambda x: x.name) @@ -144,7 +146,7 @@ class FileBatchRunnerClient(HttpClient): df_gb['position'] = df_gb['accessor_id'].apply(lambda x: range(0, len(x))) df_gb = df_gb.explode(['accessor_id', 'position']) accessor_ids.append(df_gb) - self.stacks = pd.concat(accessor_ids) + self.stacks = pd.concat(accessor_ids).reset_index() self.write_df() def queue_tasks(self): @@ -207,6 +209,9 @@ class Error(Exception): class FileNotFoundError(Error): pass +class EmptyFileListError(Error): + pass + class WatchPathVerificationError(Error): pass -- GitLab