Просмотр исходного кода

[bench] bench doctor to show if scheduler is disabled via system settings

version-14
Rushabh Mehta 9 лет назад
Родитель
Сommit
4f85bd3284
4 измененных файлов: 17 добавлений и 1 удалений
  1. +2
    -0
      frappe/__init__.py
  2. +0
    -1
      frappe/commands.py
  3. +2
    -0
      frappe/exceptions.py
  4. +13
    -0
      frappe/utils/doctor.py

+ 2
- 0
frappe/__init__.py Просмотреть файл

@@ -173,6 +173,8 @@ def get_site_config(sites_path=None, site_path=None):
site_config = os.path.join(site_path, "site_config.json")
if os.path.exists(site_config):
config.update(get_file_json(site_config))
elif local.site:
raise IncorrectSitePath, "{0} does not exist".format(site_config)

return _dict(config)



+ 0
- 1
frappe/commands.py Просмотреть файл

@@ -828,7 +828,6 @@ def request(context, args):
def doctor():
"Get diagnostic info about background workers"
from frappe.utils.doctor import doctor as _doctor
frappe.init('')
return _doctor()

@click.command('celery-doctor')


+ 2
- 0
frappe/exceptions.py Просмотреть файл

@@ -59,3 +59,5 @@ class InvalidEmailAddressError(ValidationError): pass
class TemplateNotFoundError(ValidationError): pass
class UniqueValidationError(ValidationError): pass
class AppNotInstalledError(ValidationError): pass
class IncorrectSitePath(ValidationError): pass


+ 13
- 0
frappe/utils/doctor.py Просмотреть файл

@@ -3,6 +3,7 @@ import json, base64, os
import frappe.utils
from frappe.celery_app import get_celery
from frappe.utils.file_lock import check_lock, LockTimeoutError
from frappe.utils.scheduler import is_scheduler_disabled
from collections import Counter
from operator import itemgetter

@@ -140,9 +141,21 @@ def doctor():
"""
Prints diagnostic information for the scheduler
"""
print "Inspecting workers and queues..."
workers_online = check_if_workers_online()
pending_tasks = get_pending_task_count()

print "Finding locks..."
locks = get_timedout_locks()

print "Checking scheduler status..."
for site in frappe.utils.get_sites():
frappe.init(site)
frappe.connect()
if not is_scheduler_disabled():
print "{0:40}: Scheduler disabled via System Settings or site_config.json".format(site)
frappe.destroy()

print "Workers online:", workers_online
print "Pending tasks", pending_tasks
print "Timed out locks:"


Загрузка…
Отмена
Сохранить