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
|
typing-extensions==3.10.0.0
|
||||||
ujson==4.0.2
|
ujson==4.0.2
|
||||||
urllib3==1.26.5
|
urllib3==1.26.5
|
||||||
uvloop==0.11.3
|
uvloop==0.14.0
|
||||||
websockets==8.1
|
websockets==8.1
|
||||||
yarl==1.3.0
|
yarl==1.3.0
|
||||||
|
|
|
@ -7,4 +7,4 @@ websockets
|
||||||
|
|
||||||
# cli
|
# cli
|
||||||
argh
|
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 models import Repo, Job, db, Worker
|
||||||
from schedule import always_relaunch, once_per_day
|
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"] = {
|
LOGGING_CONFIG_DEFAULTS["loggers"] = {
|
||||||
"task": {
|
"task": {
|
||||||
"level": "INFO",
|
"level": "INFO",
|
||||||
|
@ -110,8 +115,7 @@ def datetime_to_epoch_json_converter(o):
|
||||||
return o.strftime('%s')
|
return o.strftime('%s')
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def wait_closed(self):
|
||||||
def wait_closed(self):
|
|
||||||
"""
|
"""
|
||||||
Wait until the connection is closed.
|
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.
|
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
|
# 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)
|
@always_relaunch(sleep=2)
|
||||||
async def number_of_tasks():
|
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')
|
@app.route('/monitor')
|
||||||
|
@ -979,7 +983,7 @@ async def monitor(request):
|
||||||
snapshot = tracemalloc.take_snapshot()
|
snapshot = tracemalloc.take_snapshot()
|
||||||
top_stats = snapshot.statistics('lineno')
|
top_stats = snapshot.statistics('lineno')
|
||||||
|
|
||||||
tasks = Task.all_tasks()
|
tasks = asyncio_all_tasks()
|
||||||
|
|
||||||
return response.json({
|
return response.json({
|
||||||
"top_20_trace": [str(x) for x in top_stats[:20]],
|
"top_20_trace": [str(x) for x in top_stats[:20]],
|
||||||
|
|
Loading…
Add table
Reference in a new issue