mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
commit
58dafe2e08
3 changed files with 11 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -7,4 +7,4 @@ websockets
|
|||
|
||||
# cli
|
||||
argh
|
||||
requests
|
||||
requests
|
14
run.py
14
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",
|
||||
|
@ -110,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.
|
||||
|
||||
|
@ -121,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
|
||||
|
@ -971,7 +975,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 +983,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]],
|
||||
|
|
Loading…
Add table
Reference in a new issue