#247: Fixed Worker return and app SDK bug

This commit is contained in:
frikky
2021-02-21 17:00:23 +01:00
parent f4e0446bc9
commit 04e8a22a71
6 changed files with 83 additions and 42 deletions
+8 -5
View File
@@ -541,8 +541,9 @@ class AppBase:
"status": "EXECUTING"
}
# Simple validation of parameters in general
try:
print(action["parameters"])
tmp_parameters = action["parameters"]
except KeyError:
action["parameters"] = []
except TypeError:
@@ -1514,11 +1515,13 @@ class AppBase:
if len(json_replacement) > minlength:
minlength = len(json_replacement)
print("PRE new_replacement")
# FIXME: Only do this IF they want to loop
new_replacement = []
for i in range(len(json_replacement)):
if isinstance(json_replacement[i], dict) or isinstance(json_replacement[i], dict):
if isinstance(json_replacement[i], dict) or isinstance(json_replacement[i], list):
tmp_replacer = json.dumps(json_replacement[i])
newvalue = tmpitem.replace(actualitem[0][0], tmp_replacer, 1)
else:
@@ -1727,7 +1730,7 @@ class AppBase:
#print("[INFO] APP_SDK DONE: Starting NORMAL execution of function")
print("[INFO] Running normal execution\n")
newres = await func(**params)
print("\n[INFO] Returned from execution:", newres)
print("\n[INFO] Returned from execution with datalength!")#, newres)
if isinstance(newres, tuple):
print("[INFO] Handling return as tuple")
# Handles files.
@@ -1753,7 +1756,7 @@ class AppBase:
result = json.dumps(tmp_result)
elif isinstance(newres, str):
print("[INFO] Handling return as string")
print("[INFO] Handling return as string of length %d" % len(newres))
result += newres
else:
try:
@@ -1762,7 +1765,7 @@ class AppBase:
result += "Failed autocasting. Can't handle %s type from function. Must be string" % type(newres)
print("Can't handle type %s value from function" % (type(newres)))
print("[INFO] POST NEWRES RESULT: ", result)
print("[INFO] POST NEWRES RESULT!")#, result)
else:
#print("[INFO] APP_SDK DONE: Starting MULTI execution (length: %d) with values %s" % (minlength, multi_parameters))
# 1. Use number of executions based on the arrays being similar
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
NAME=shuffle-app_sdk
VERSION=0.8.56
VERSION=0.8.57
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
docker build . -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION
+5
View File
@@ -6163,6 +6163,11 @@ func loadSpecificApps(resp http.ResponseWriter, request *http.Request) {
return
}
cacheKey := fmt.Sprintf("workflowapps-sorted-100")
requestCache.Delete(cacheKey)
cacheKey = fmt.Sprintf("workflowapps-sorted-500")
requestCache.Delete(cacheKey)
resp.WriteHeader(200)
resp.Write([]byte(fmt.Sprintf(`{"success": true}`)))
}