fix: misc (#24303)
* fix(DX): improve logging in various places * fix(ux): misc RQ worker and job fixes
This commit is contained in:
parent
e45e313bfb
commit
b3eaec4347
7 changed files with 23 additions and 8 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"autoname": "field:job_id",
|
||||
"creation": "2022-09-10 16:19:37.934903",
|
||||
"creation": "2023-03-22 20:05:22.962044",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
|
|
@ -104,10 +104,11 @@
|
|||
"fieldtype": "Section Break"
|
||||
}
|
||||
],
|
||||
"hide_toolbar": 1,
|
||||
"in_create": 1,
|
||||
"is_virtual": 1,
|
||||
"links": [],
|
||||
"modified": "2022-09-11 05:27:50.878534",
|
||||
"modified": "2024-01-13 10:38:40.230972",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "RQ Job",
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ class RQJob(Document):
|
|||
]
|
||||
time_taken: DF.Duration | None
|
||||
timeout: DF.Duration | None
|
||||
|
||||
# end: auto-generated types
|
||||
|
||||
def load_from_db(self):
|
||||
try:
|
||||
job = Job.fetch(self.name, connection=get_redis_conn())
|
||||
|
|
|
|||
|
|
@ -110,10 +110,11 @@
|
|||
"label": "Utilization %"
|
||||
}
|
||||
],
|
||||
"hide_toolbar": 1,
|
||||
"in_create": 1,
|
||||
"is_virtual": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-24 14:50:48.511706",
|
||||
"modified": "2024-01-13 10:36:13.034784",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Core",
|
||||
"name": "RQ Worker",
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class RQWorker(Document):
|
|||
total_working_time: DF.Duration | None
|
||||
utilization_percent: DF.Percent
|
||||
worker_name: DF.Data | None
|
||||
|
||||
# end: auto-generated types
|
||||
|
||||
def load_from_db(self):
|
||||
|
||||
all_workers = get_workers()
|
||||
|
|
|
|||
9
frappe/core/doctype/rq_worker/rq_worker_list.js
Normal file
9
frappe/core/doctype/rq_worker/rq_worker_list.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
frappe.listview_settings["RQ Worker"] = {
|
||||
refresh(listview) {
|
||||
listview.$no_result.html(`
|
||||
<div class="no-result text-muted flex justify-center align-center">
|
||||
${__("No RQ Workers connected. Try restarting the bench.")}
|
||||
</div>
|
||||
`);
|
||||
},
|
||||
};
|
||||
|
|
@ -189,6 +189,7 @@ def get_all_translations(lang: str) -> dict[str, str]:
|
|||
except Exception:
|
||||
# People mistakenly call translation function on global variables
|
||||
# where locals are not initalized, translations dont make much sense there
|
||||
frappe.logger().error("Unable to load translations", exc_info=True)
|
||||
return {}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -506,15 +506,18 @@ def get_redis_conn(username=None, password=None):
|
|||
return get_redis_connection_without_auth()
|
||||
else:
|
||||
return RedisQueue.get_connection(**cred)
|
||||
except (redis.exceptions.AuthenticationError, redis.exceptions.ResponseError):
|
||||
except redis.exceptions.AuthenticationError:
|
||||
log(
|
||||
f'Wrong credentials used for {cred.username or "default user"}. '
|
||||
"You can reset credentials using `bench create-rq-users` CLI and restart the server",
|
||||
colour="red",
|
||||
)
|
||||
raise
|
||||
except Exception:
|
||||
log(f"Please make sure that Redis Queue runs @ {frappe.get_conf().redis_queue}", colour="red")
|
||||
except Exception as e:
|
||||
log(
|
||||
f"Please make sure that Redis Queue runs @ {frappe.get_conf().redis_queue}. Redis reported error: {str(e)}",
|
||||
colour="red",
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue