[bench] bench doctor to show if scheduler is disabled via system settings
This commit is contained in:
parent
378053d119
commit
4f85bd3284
4 changed files with 17 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -59,3 +59,5 @@ class InvalidEmailAddressError(ValidationError): pass
|
|||
class TemplateNotFoundError(ValidationError): pass
|
||||
class UniqueValidationError(ValidationError): pass
|
||||
class AppNotInstalledError(ValidationError): pass
|
||||
class IncorrectSitePath(ValidationError): pass
|
||||
|
||||
|
|
|
|||
|
|
@ -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:"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue