def block_user(block):
 frappe.local.flags.in_patch = block
 frappe.db.begin()
 msg = u'Patches are being executed in the system. Please try again in a few moments.'
 frappe.db.set_global(u'__session_status', ((block and u'stop') or None))
 frappe.db.set_global(u'__session_status_message', ((block and msg) or None))
 frappe.db.commit()

def block_user ( block ) : frappe . local . flags . in_patch = block frappe . db . begin ( ) msg = u'Patches are being executed in the system. Please try again in a few moments.' frappe . db . set_global ( u'__session_status' , ( ( block and u'stop' ) or None ) ) frappe . db . set_global ( u'__session_status_message' , ( ( block and msg ) or None ) ) frappe . db . commit ( )
stop/start execution till patch is run .