From 673fabf193642a8946f9a534b9a21a8357808712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20Jer=C5=A1e?= Date: Tue, 14 Nov 2023 12:09:32 +0100 Subject: [PATCH] White or black list processes in dispatcher This is q&d solution just for testing. --- resolwe/flow/managers/dispatcher.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/resolwe/flow/managers/dispatcher.py b/resolwe/flow/managers/dispatcher.py index d436cdaba..412fcfb15 100644 --- a/resolwe/flow/managers/dispatcher.py +++ b/resolwe/flow/managers/dispatcher.py @@ -669,6 +669,17 @@ def process_data_object(data: Data): try: queryset = Data.objects.filter(status=Data.STATUS_RESOLVING) + + whitelist = json.loads(os.environ.get("RESOLWE_PROCESS_WHITELIST", "null")) + blacklist = json.loads(os.environ.get("RESOLWE_PROCESS_BLACKLIST", "null")) + + if whitelist: + assert isinstance(whitelist, list) + queryset = queryset.filter(process__slug__in=whitelist) + if blacklist: + assert isinstance(blacklist, list) + queryset = queryset.exclude(process__slug__in=blacklist) + if data_id is not None: # Scan only given data object and its children. queryset = queryset.filter(