Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions shuffle_sdk/shuffle_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,19 @@ def send_result(self, action_result, headers, stream_path):
if not "User-Agent" in headers:
headers["User-Agent"] = "Shuffle App"

try:
#self.logger.info(f"[INFO] Size of result: {len(json.dumps(action_result['result']).encode('utf-8'))}")
json_size = len(json.dumps(action_result["result"]).encode('utf-8'))
# 20MB limit
if json_size > 20000000:
action_result["status"] = "FAILURE"
action_result["result"] = json.dumps({"success": False, "reason": "Result too large to send to backend. Size: %d MB. Max: 20MB" % (json_size//(1024*1024))})
except Exception as e:
self.logger.info(f"[ERROR] Failed to get size of result: {e}")


self.logger.info(f"[DEBUG][{self.current_execution_id}] Starting to send result to {url}")

try:
finished = False
ret = {}
Expand Down Expand Up @@ -2008,13 +2020,8 @@ def execute_action(self, action):
try:
if replace_params == True:
for inner_action in self.full_execution["workflow"]["actions"]:
self.logger.info("[DEBUG] ID: %s vs %s" % (inner_action["id"], self.action["id"]))

# In case of some kind of magic, we're just doing params
if inner_action["id"] != self.action["id"]:
continue
self.logger.info("FOUND!")

if inner_action["id"] == self.action["id"]:
if isinstance(self.action, str):
self.logger.info("Params is in string object for self.action?")
else:
Expand Down