Added simple initial Swarm setup with scalability

This commit is contained in:
frikky
2021-11-06 03:12:14 +01:00
parent 9dd618ecfe
commit 9a9ea3358d
529 changed files with 359 additions and 116 deletions
+7 -7
View File
@@ -594,7 +594,7 @@ class AppBase:
# An attempt at decomposing coroutine results
try:
if asyncio.iscoroutine(tmp):
print("In coroutine")
self.logger.info("[DEBUG] In coroutine (2)")
async def parse_value(tmp):
value = await asyncio.gather(
tmp
@@ -605,9 +605,9 @@ class AppBase:
tmp = asyncio.run(parse_value(tmp))
else:
print("Not in coroutine")
self.logger.info("[DEBUG] Not in coroutine (2)")
except Exception as e:
print("[ERROR] Failed to parse coroutine value for old app: {e}")
self.logger.warning("[ERROR] Failed to parse coroutine value for old app: {e}")
#self.logger.info("RET from execution: %s" % ret)
new_value = tmp
@@ -2615,7 +2615,7 @@ class AppBase:
# Forcing async wait in case of old apps that use async
try:
if asyncio.iscoroutine(newres):
print("In coroutine")
self.logger.info("[DEBUG] In coroutine (1)")
async def parse_value(newres):
value = await asyncio.gather(
newres
@@ -2625,9 +2625,9 @@ class AppBase:
newres = asyncio.run(parse_value(newres))
else:
print("Not in coroutine")
self.logger.info("[DEBUG] Not in coroutine (1)")
except Exception as e:
print("[ERROR] Failed to parse coroutine value for old app: {e}")
self.logger.warning("[ERROR] Failed to parse coroutine value for old app: {e}")
self.logger.info("\n[INFO] Returned from execution with types %s" % type(newres))
#self.logger.info("\n[INFO] Returned from execution with %s of types %s" % (newres, type(newres)))#, newres)
@@ -2890,7 +2890,7 @@ class AppBase:
port = int(exposed_port)
logger.info(f"[DEBUG] Starting webserver on port {port} (same as exposed port)")
from flask import Flask, request
from waitress import serve
#from waitress import serve
flask_app = Flask(__name__)