From a70a0df5a8909c1ac536184966d6d259b835cd44 Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Tue, 7 Jan 2025 15:19:10 +0530 Subject: [PATCH 1/4] removed debug log --- shuffle-tools/1.2.0/src/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shuffle-tools/1.2.0/src/app.py b/shuffle-tools/1.2.0/src/app.py index 7fa24fff..ad11adb1 100644 --- a/shuffle-tools/1.2.0/src/app.py +++ b/shuffle-tools/1.2.0/src/app.py @@ -1920,7 +1920,7 @@ def check_cache_contains(self, key, value, append): try: for item in parsedvalue: #return "%s %s" % (item, value) - self.logger.info(f"{item} == {value}") + #self.logger.info(f"{item} == {value}") if str(item) == str(value): if not append: try: From aaf15d2b5bcc9f23f9e460b3a345476c23d4e4c3 Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Tue, 7 Jan 2025 20:25:03 +0530 Subject: [PATCH 2/4] [fix]: check_cache_contains failing due to shared cache --- shuffle-tools/1.2.0/src/app.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shuffle-tools/1.2.0/src/app.py b/shuffle-tools/1.2.0/src/app.py index ad11adb1..934cd364 100644 --- a/shuffle-tools/1.2.0/src/app.py +++ b/shuffle-tools/1.2.0/src/app.py @@ -1807,6 +1807,7 @@ def escape_html(self, input_data): def check_cache_contains(self, key, value, append): org_id = self.full_execution["workflow"]["execution_org"]["id"] + url = "%s/api/v1/orgs/%s/get_cache" % (self.url, org_id) data = { "workflow_id": self.full_execution["workflow"]["id"], "execution_id": self.current_execution_id, @@ -1855,6 +1856,10 @@ def check_cache_contains(self, key, value, append): #allvalues = get_response.json() allvalues = self.shared_cache + if "success" not in allvalues: + get_response = requests.post(url, json=data, verify=False) + allvalues = get_response.json() + try: if allvalues["value"] == None or allvalues["value"] == "null": allvalues["value"] = "[]" From be8c311307fd6e1e35cee12282d0424c0d1f050c Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Sat, 11 Jan 2025 01:38:02 +0530 Subject: [PATCH 3/4] fixed list condition check --- shuffle-tools/1.2.0/src/app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/shuffle-tools/1.2.0/src/app.py b/shuffle-tools/1.2.0/src/app.py index 934cd364..ef7eb955 100644 --- a/shuffle-tools/1.2.0/src/app.py +++ b/shuffle-tools/1.2.0/src/app.py @@ -1816,6 +1816,7 @@ def check_cache_contains(self, key, value, append): "search": str(value), "key": key, } + directcall = False allvalues = {} try: @@ -1859,6 +1860,7 @@ def check_cache_contains(self, key, value, append): if "success" not in allvalues: get_response = requests.post(url, json=data, verify=False) allvalues = get_response.json() + directcall = True try: if allvalues["value"] == None or allvalues["value"] == "null": @@ -1977,11 +1979,13 @@ def check_cache_contains(self, key, value, append): if value not in allvalues["value"] and isinstance(allvalues["value"], list): self.cache_update_buffer.append(value) allvalues["value"].append(value) - #set_url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id) - #response = requests.post(set_url, json=data, verify=False) exception = "" try: - #allvalues = response.json() + if directcall: + set_url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id) + response = requests.post(set_url, json=data, verify=False) + allvalues = response.json() + #return allvalues return { From 788aa3497d51ac74d0f137090de463d8b45f0a96 Mon Sep 17 00:00:00 2001 From: yashsinghcodes Date: Sat, 11 Jan 2025 02:06:50 +0530 Subject: [PATCH 4/4] [fix]: Minor bugs in check_cache --- shuffle-tools/1.2.0/run.sh | 4 ++-- shuffle-tools/1.2.0/src/app.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) mode change 100644 => 100755 shuffle-tools/1.2.0/run.sh diff --git a/shuffle-tools/1.2.0/run.sh b/shuffle-tools/1.2.0/run.sh old mode 100644 new mode 100755 index aaf4edf7..3480d2f8 --- a/shuffle-tools/1.2.0/run.sh +++ b/shuffle-tools/1.2.0/run.sh @@ -1,7 +1,7 @@ # Build testing -NAME=frikky/shuffle:shuffle-tools_1.1.0 +NAME=frikky/shuffle:shuffle-tools_1.2.0 docker rmi $NAME --force -docker build . -t frikky/shuffle:shuffle-tools_1.1.0 +docker build . -t frikky/shuffle:shuffle-tools_1.2.0 # Run testing #docker run -e SHUFFLE_SWARM_CONFIG=run -e SHUFFLE_APP_EXPOSED_PORT=33334 frikky/shuffle:shuffle-tools_1.1.0 diff --git a/shuffle-tools/1.2.0/src/app.py b/shuffle-tools/1.2.0/src/app.py index ef7eb955..01af7e34 100644 --- a/shuffle-tools/1.2.0/src/app.py +++ b/shuffle-tools/1.2.0/src/app.py @@ -1981,7 +1981,14 @@ def check_cache_contains(self, key, value, append): allvalues["value"].append(value) exception = "" try: + # FIXME: This is a hack, but it works if directcall: + new_value = parsedvalue + if new_value == None: + new_value = [value] + + data["value"] = json.dumps(new_value) + set_url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id) response = requests.post(set_url, json=data, verify=False) allvalues = response.json() @@ -1991,7 +1998,7 @@ def check_cache_contains(self, key, value, append): return { "success": True, "found": False, - "reason": "Appended as it didn't exist", + "reason": f"Appended as it didn't exist", "key": key, "search": value, "value": parsedvalue,