Skip to content

Commit

Permalink
Merge branch 'frappe:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
metalmon authored Dec 20, 2024
2 parents 3068976 + bbf1abf commit 436f3de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frappe/core/doctype/prepared_report/prepared_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"column_break_4",
"queued_at",
"report_end_time",
"peak_memory_usage",
"section_break_7",
"error_message",
"filters_sb",
Expand Down Expand Up @@ -101,11 +102,18 @@
"is_virtual": 1,
"label": "Queued At",
"read_only": 1
},
{
"fieldname": "peak_memory_usage",
"fieldtype": "Int",
"label": "Peak Memory Usage",
"print_hide": 1,
"read_only": 1
}
],
"in_create": 1,
"links": [],
"modified": "2024-03-23 16:03:34.835357",
"modified": "2024-12-20 10:18:19.174608",
"modified_by": "Administrator",
"module": "Core",
"name": "Prepared Report",
Expand Down
4 changes: 4 additions & 0 deletions frappe/core/doctype/prepared_report/prepared_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# License: MIT. See LICENSE
import gzip
import json
import resource
from contextlib import suppress
from typing import Any

Expand Down Expand Up @@ -33,6 +34,7 @@ class PreparedReport(Document):
error_message: DF.Text | None
filters: DF.SmallText | None
job_id: DF.Data | None
peak_memory_usage: DF.Int
queued_at: DF.Datetime | None
queued_by: DF.Data | None
report_end_time: DF.Datetime | None
Expand Down Expand Up @@ -119,6 +121,8 @@ def generate_report(prepared_report):
_save_error(instance, error=frappe.get_traceback(with_context=True))

instance.report_end_time = frappe.utils.now()
instance.peak_memory_usage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
add_data_to_monitor(peak_memory_usage=instance.peak_memory_usage)
instance.save(ignore_permissions=True)

frappe.publish_realtime(
Expand Down

0 comments on commit 436f3de

Please sign in to comment.