Skip to content

Commit 4cd1ba1

Browse files
committed
Merge branch 'master' of https://github.com/shuffle/python-apps
2 parents 067f4e8 + 5fce896 commit 4cd1ba1

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

shuffle-tools/1.2.0/run.sh

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Build testing
2-
NAME=frikky/shuffle:shuffle-tools_1.1.0
2+
NAME=frikky/shuffle:shuffle-tools_1.2.0
33
docker rmi $NAME --force
4-
docker build . -t frikky/shuffle:shuffle-tools_1.1.0
4+
docker build . -t frikky/shuffle:shuffle-tools_1.2.0
55

66
# Run testing
77
#docker run -e SHUFFLE_SWARM_CONFIG=run -e SHUFFLE_APP_EXPOSED_PORT=33334 frikky/shuffle:shuffle-tools_1.1.0

shuffle-tools/1.2.0/src/app.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,6 +1807,7 @@ def escape_html(self, input_data):
18071807

18081808
def check_cache_contains(self, key, value, append):
18091809
org_id = self.full_execution["workflow"]["execution_org"]["id"]
1810+
url = "%s/api/v1/orgs/%s/get_cache" % (self.url, org_id)
18101811
data = {
18111812
"workflow_id": self.full_execution["workflow"]["id"],
18121813
"execution_id": self.current_execution_id,
@@ -1815,6 +1816,7 @@ def check_cache_contains(self, key, value, append):
18151816
"search": str(value),
18161817
"key": key,
18171818
}
1819+
directcall = False
18181820

18191821
allvalues = {}
18201822
try:
@@ -1855,6 +1857,11 @@ def check_cache_contains(self, key, value, append):
18551857
#allvalues = get_response.json()
18561858
allvalues = self.shared_cache
18571859

1860+
if "success" not in allvalues:
1861+
get_response = requests.post(url, json=data, verify=False)
1862+
allvalues = get_response.json()
1863+
directcall = True
1864+
18581865
try:
18591866
if allvalues["value"] == None or allvalues["value"] == "null":
18601867
allvalues["value"] = "[]"
@@ -1920,7 +1927,7 @@ def check_cache_contains(self, key, value, append):
19201927
try:
19211928
for item in parsedvalue:
19221929
#return "%s %s" % (item, value)
1923-
self.logger.info(f"{item} == {value}")
1930+
#self.logger.info(f"{item} == {value}")
19241931
if str(item) == str(value):
19251932
if not append:
19261933
try:
@@ -1972,17 +1979,26 @@ def check_cache_contains(self, key, value, append):
19721979
if value not in allvalues["value"] and isinstance(allvalues["value"], list):
19731980
self.cache_update_buffer.append(value)
19741981
allvalues["value"].append(value)
1975-
#set_url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id)
1976-
#response = requests.post(set_url, json=data, verify=False)
19771982
exception = ""
19781983
try:
1979-
#allvalues = response.json()
1984+
# FIXME: This is a hack, but it works
1985+
if directcall:
1986+
new_value = parsedvalue
1987+
if new_value == None:
1988+
new_value = [value]
1989+
1990+
data["value"] = json.dumps(new_value)
1991+
1992+
set_url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id)
1993+
response = requests.post(set_url, json=data, verify=False)
1994+
allvalues = response.json()
1995+
19801996
#return allvalues
19811997

19821998
return {
19831999
"success": True,
19842000
"found": False,
1985-
"reason": "Appended as it didn't exist",
2001+
"reason": f"Appended as it didn't exist",
19862002
"key": key,
19872003
"search": value,
19882004
"value": parsedvalue,

0 commit comments

Comments
 (0)