diff --git a/press/press/doctype/serial_console_log/serial_console_log.py b/press/press/doctype/serial_console_log/serial_console_log.py index 4cf44c7222..94967d1d33 100644 --- a/press/press/doctype/serial_console_log/serial_console_log.py +++ b/press/press/doctype/serial_console_log/serial_console_log.py @@ -1,6 +1,8 @@ # Copyright (c) 2023, Frappe and contributors # For license information, please see license.txt +from __future__ import annotations + import time from io import StringIO @@ -60,13 +62,12 @@ def run_sysrq(self): method="_run_sysrq", queue="long", enqueue_after_commit=True, + at_front=True, ) frappe.db.commit() def _run_sysrq(self): - credentials = frappe.get_doc( - "Virtual Machine", self.virtual_machine - ).get_serial_console_credentials() + credentials = frappe.get_doc("Virtual Machine", self.virtual_machine).get_serial_console_credentials() ssh = pexpect.spawn(credentials["command"], encoding="utf-8") ssh.logfile = FakeIO(self) @@ -116,9 +117,7 @@ def __init__(self, serial_console_log, *args, **kwargs): def flush(self): super().flush() output = ansi_escape(self.getvalue()) - frappe.db.set_value( - "Serial Console Log", self.console, "output", output, update_modified=False - ) + frappe.db.set_value("Serial Console Log", self.console, "output", output, update_modified=False) message = {"name": self.console, "output": output} frappe.publish_realtime(