From 19f5bcd0004008ebb53cb4099685a70f239c32a2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 01:22:10 +0200 Subject: [PATCH 1/7] Update requirements for bullseye --- requirements-frozen.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-frozen.txt b/requirements-frozen.txt index c5b4219..3f7fc62 100644 --- a/requirements-frozen.txt +++ b/requirements-frozen.txt @@ -20,6 +20,6 @@ sanic-routing==0.6.2 typing-extensions==3.10.0.0 ujson==4.0.2 urllib3==1.26.5 -uvloop==0.11.3 +uvloop==0.14.0 websockets==8.1 yarl==1.3.0 From 5572f746ef9ef735a854e3e8e96865c721e962b0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 01:48:24 +0200 Subject: [PATCH 2/7] Fix AttributeError: type object '_asyncio.Task' has no attribute 'all_tasks' --- run.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 99f8a20..20cea41 100644 --- a/run.py +++ b/run.py @@ -40,6 +40,11 @@ from playhouse.shortcuts import model_to_dict from models import Repo, Job, db, Worker from schedule import always_relaunch, once_per_day +try: + asyncio_all_tasks = asyncio.all_tasks +except AttributeError as e: + asyncio_all_tasks = asyncio.Task.all_tasks + LOGGING_CONFIG_DEFAULTS["loggers"] = { "task": { "level": "INFO", @@ -971,7 +976,7 @@ async def html_index(request): @always_relaunch(sleep=2) async def number_of_tasks(): - print("Number of tasks: %s" % len(Task.all_tasks())) + print("Number of tasks: %s" % len(asyncio_all_tasks())) @app.route('/monitor') @@ -979,7 +984,7 @@ async def monitor(request): snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') - tasks = Task.all_tasks() + tasks = asyncio_all_tasks() return response.json({ "top_20_trace": [str(x) for x in top_stats[:20]], From 6508dcf51d094d3c748269d6a3fb1a1acc26537a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 02:13:08 +0200 Subject: [PATCH 3/7] Fix DeprecationWarning: "@coroutine" python[11090]: /var/www/yunorunner/./run.py:119: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead python[11090]: def wait_closed(self): --- run.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/run.py b/run.py index 20cea41..77711c7 100644 --- a/run.py +++ b/run.py @@ -115,8 +115,7 @@ def datetime_to_epoch_json_converter(o): return o.strftime('%s') -@asyncio.coroutine -def wait_closed(self): +async def wait_closed(self): """ Wait until the connection is closed. @@ -126,7 +125,7 @@ def wait_closed(self): of its cause, in tasks that interact with the WebSocket connection. """ - yield from asyncio.shield(self.connection_lost_waiter) + await asyncio.shield(self.connection_lost_waiter) # this is a backport of websockets 7.0 which sanic doesn't support yet From dabfc174f4194048fa3b5196719a6da699aa8998 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 03:17:50 +0200 Subject: [PATCH 4/7] Update requirements.txt --- requirements.txt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/requirements.txt b/requirements.txt index ff70ef1..39ad08a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,8 @@ -sanic -aiohttp -aiofiles -peewee -sanic-jinja2 -websockets - -# cli -argh -requests +Jinja2==2.11.3 +aiofiles==0.7.0 +aiohttp==3.7.4.post0 +argh==0.26.2 +peewee==3.14.4 +sanic==21.6.0 +sanic_jinja2==0.10.0 +websockets==9.1 From fe8789e4a6f7e552c4f78ec7871b5d2f7f5a9f00 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 03:58:48 +0200 Subject: [PATCH 5/7] Update requirements-frozen.txt --- requirements-frozen.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-frozen.txt b/requirements-frozen.txt index 3f7fc62..0271ead 100644 --- a/requirements-frozen.txt +++ b/requirements-frozen.txt @@ -21,5 +21,5 @@ typing-extensions==3.10.0.0 ujson==4.0.2 urllib3==1.26.5 uvloop==0.14.0 -websockets==8.1 +websockets==9.1 yarl==1.3.0 From 9cde6e979a59424396659fa934323a677ba8c960 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 04:19:53 +0200 Subject: [PATCH 6/7] Update requirements-frozen.txt --- requirements-frozen.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-frozen.txt b/requirements-frozen.txt index 0271ead..3f7fc62 100644 --- a/requirements-frozen.txt +++ b/requirements-frozen.txt @@ -21,5 +21,5 @@ typing-extensions==3.10.0.0 ujson==4.0.2 urllib3==1.26.5 uvloop==0.14.0 -websockets==9.1 +websockets==8.1 yarl==1.3.0 From 03ee99a8f72203d8f14986bc88cca45e36ac4895 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 30 Jun 2021 05:10:10 +0200 Subject: [PATCH 7/7] Update requirements.txt --- requirements.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/requirements.txt b/requirements.txt index 39ad08a..d424716 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,10 @@ -Jinja2==2.11.3 -aiofiles==0.7.0 -aiohttp==3.7.4.post0 -argh==0.26.2 -peewee==3.14.4 -sanic==21.6.0 -sanic_jinja2==0.10.0 -websockets==9.1 +sanic +aiohttp +aiofiles +peewee +sanic-jinja2 +websockets + +# cli +argh +requests \ No newline at end of file