From 4517bf3257f44be42ce80add9e44fe1168888b10 Mon Sep 17 00:00:00 2001 From: Louis Radtke Date: Thu, 21 Apr 2022 11:03:50 +0200 Subject: [PATCH 1/2] Fix worker registering trashed bags --- rbb_tools/src/rbb_tools/commands/index.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rbb_tools/src/rbb_tools/commands/index.py b/rbb_tools/src/rbb_tools/commands/index.py index ccdbb2e..b77d8db 100644 --- a/rbb_tools/src/rbb_tools/commands/index.py +++ b/rbb_tools/src/rbb_tools/commands/index.py @@ -64,7 +64,8 @@ def command(store_name, api): return try: - bags = api.list_bags(store_name) + bags = api.list_bags(store_name, in_trash=False) + trashed_bags = api.list_bags(store_name, in_trash=True) except Exception as e: print("Reason: " + str(e)) return @@ -74,11 +75,19 @@ def command(store_name, api): info = store.list_file(bag.store_data) bags_by_name[info.get_path()] = bag + trashed_bags_by_name = {} + for bag in trashed_bags: + info = store.list_file(bag.store_data) + trashed_bags_by_name[info.get_path()] = bag + store_files = store.list_files() for file in store_files: if file.get_name()[-3:] != "bag": continue + if file.get_path() in trashed_bags_by_name: + continue + if not file.get_path() in bags_by_name: print("NEW: %s at %s" % (file.get_save_name(), file.get_path())) register_bag_file(api, store_info.name, file) From cf524f07fed87015cb55da0285547b067e93b3e7 Mon Sep 17 00:00:00 2001 From: Louis Radtke Date: Thu, 21 Apr 2022 14:04:48 +0200 Subject: [PATCH 2/2] Explicitly setting in_trash=False when registering bag --- rbb_tools/src/rbb_tools/commands/index.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rbb_tools/src/rbb_tools/commands/index.py b/rbb_tools/src/rbb_tools/commands/index.py index b77d8db..641332b 100644 --- a/rbb_tools/src/rbb_tools/commands/index.py +++ b/rbb_tools/src/rbb_tools/commands/index.py @@ -38,6 +38,7 @@ def register_bag_file(api, store_name, file): bag.topics=[] bag.products=[] bag.extraction_failure = False + bag.in_trash = False api.put_bag_meta(store_name, bag.name, bag)