MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit 02cae322 authored by Mikaël Salson's avatar Mikaël Salson Committed by marc duez
Browse files

server/admin: Restart workers

Fix #3554, inspired by vdj#727
parent 6c9a9b9f
...@@ -775,9 +775,9 @@ Disks failures or other events could have triggered a read-only partition. ...@@ -775,9 +775,9 @@ Disks failures or other events could have triggered a read-only partition.
For some reasons, that are not clear yet, it may happen that workers are not For some reasons, that are not clear yet, it may happen that workers are not
assigned any additional jobs even if they don't have any ongoing jobs. assigned any additional jobs even if they don't have any ongoing jobs.
In such a (rare) case, it may be useful to restart web2py schedulers In such a (rare) case, it may be useful to restart the workers by clicking on
with `service web2py-scheduler restart` or `initctl restart web2py-scheduler` the *reset workers* link in the Vidjil administration interface. Restarting
depending on your installation. workers won't be performed if jobs are currently running or assigned.
## Debugging Web2py workers ## Debugging Web2py workers
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import gluon.contrib.simplejson, re import gluon.contrib.simplejson, re
import os.path, subprocess import os.path, subprocess
import vidjil_utils import vidjil_utils
from gluon.scheduler import RUNNING, QUEUED, ASSIGNED
MAX_LOG_LINES = 500 MAX_LOG_LINES = 500
ACCESS_DENIED = "access denied" ACCESS_DENIED = "access denied"
...@@ -194,4 +194,14 @@ def repair(): ...@@ -194,4 +194,14 @@ def repair():
log.admin(res) log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':')) return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def reset_workers():
if auth.is_admin():
running_jobs = db((db.scheduler_task.status == RUNNING) | (db.scheduler_task.status == ASSIGNED)).count()
if running_jobs == 0:
db(db.scheduler_worker.id > 0).delete()
db.commit()
res = {"success" : "true", "message" : "Workers have been reset "}
else:
res = {"success" : "false", "message" : "Jobs are currently running or assigned. I don't want to restart workers"}
log.admin(res)
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<a class="button" onclick="db.call('admin/repair_missing_files');">fix missing files</a> <a class="button" onclick="db.call('admin/repair_missing_files');">fix missing files</a>
<a class="button" onclick="db.call('admin/repair');">repair db</a> <a class="button" onclick="db.call('admin/repair');">repair db</a>
<a class="button" onclick="db.call('admin/make_backup');">make backup</a> <a class="button" onclick="db.call('admin/make_backup');">make backup</a>
<a class="button" title="When jobs remain QUEUED, restarting workers may help" onclick="db.call('admin/reset_workers');">reset workers</a>
</br> </br>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment