@@ -1649,6 +1649,23 @@ def delete_cache(self, key, category=""):
16491649 #return response.json()
16501650 return json .dumps ({"success" : False , "reason" : f"Failed to delete cache for key '{ key } '" })
16511651
1652+ def list_category (self , category , items = 50 ):
1653+
1654+ if len (category ) == 0 :
1655+ return {"success" : False , "reason" : "Category can't be empty" }
1656+
1657+ org_id = self .full_execution ["workflow" ]["execution_org" ]["id" ]
1658+ url = "%s/api/v2/datastore?category=%s&top=%d" % (self .url , category , items )
1659+ resp = requests .get (url , verify = False , proxies = self .proxy_config )
1660+ return {
1661+ "success" : resp .status_code == 200 ,
1662+ "status" : resp .status_code ,
1663+ "url" : url ,
1664+ "details" : "Execution Auth is not implemented for this action yet. Please use the API directly."
1665+
1666+ "body" : resp .text ,
1667+ }
1668+
16521669 def set_key (self , key , value , category = "" ):
16531670 return self .set_cache (key , value , category = category )
16541671
@@ -3973,11 +3990,12 @@ def check_branch_conditions(action, fullexecution, self):
39733990 timeout = 55
39743991
39753992 timeout_env = os .getenv ("SHUFFLE_APP_SDK_TIMEOUT" , timeout )
3976- try :
3977- timeout = int (timeout_env )
3978- #self.logger.info(f"[DEBUG] Timeout set to {timeout} seconds")
3979- except Exception as e :
3980- self .logger .info (f"[ERROR] Failed parsing timeout to int: { e } " )
3993+ if len (timeout_env ) > 0 :
3994+ try :
3995+ timeout = int (timeout_env )
3996+ #self.logger.info(f"[DEBUG] Timeout set to {timeout} seconds")
3997+ except Exception as e :
3998+ self .logger .info (f"[ERROR] Failed parsing timeout to int: { e } " )
39813999
39824000 # Single exec
39834001 if not multiexecution :
@@ -4454,20 +4472,22 @@ def execute():
44544472
44554473 logger .info (f"[DEBUG] Serving on port { port } " )
44564474
4457- #flask_app.run(
4458- # host="0.0.0.0",
4459- # port=port,
4460- # threaded=True,
4461- # processes=1,
4462- # debug=False,
4463- #)
4475+ #timeout = 30
4476+ #timeout_env = os.getenv("SHUFFLE_APP_SDK_TIMEOUT", timeout)
4477+ #try:
4478+ # timeout = int(timeout_env)
4479+ #except Exception as e:
4480+ # pass
44644481
4482+ # Can run channel_timeout low because socket closes, BUT thread stays open
44654483 serve (
44664484 flask_app ,
44674485 host = "0.0.0.0" ,
44684486 port = port ,
44694487 threads = 8 ,
4470- channel_timeout = 30 ,
4488+ backlog = 2048 ,
4489+ channel_timeout = 2 ,
4490+ connection_limit = 1000 ,
44714491 expose_tracebacks = True ,
44724492 asyncore_use_poll = True ,
44734493 )
0 commit comments