def test_response(self): result = run_async_task.delay(site=frappe.local.site, user='******', cmd='async_ping', form_dict=frappe._dict()) result = result.get() self.assertEquals(result.get("message"), "pong")
def _run(args, set_in_response=True): from frappe.tasks import run_async_task from frappe.handler import execute_cmd if frappe.conf.disable_async: return execute_cmd(cmd, from_async=True) args = frappe._dict(args) task = run_async_task.delay(frappe.local.site, (frappe.session and frappe.session.user) or 'Administrator', cmd, args) if set_in_response: frappe.local.response['task_id'] = task.id return task.id
def queue(*args, **kwargs): from frappe.tasks import run_async_task from frappe.handler import execute_cmd if frappe.conf.disable_async: return execute_cmd(cmd, from_async=True) task = run_async_task.delay(frappe.local.site, (frappe.session and frappe.session.user) or 'Administrator', cmd, frappe.local.form_dict) frappe.local.response['task_id'] = task.id return {"status": "queued", "task_id": task.id}
def queue(*args, **kwargs): from frappe.tasks import run_async_task from frappe.handler import execute_cmd if frappe.conf.disable_async: return execute_cmd(cmd, from_async=True) task = run_async_task.delay(frappe.local.site, (frappe.session and frappe.session.user) or 'Administrator', cmd, frappe.local.form_dict) frappe.local.response['task_id'] = task.id return { "status": "queued", "task_id": task.id }
def run(args, set_in_response=True): from frappe.tasks import run_async_task from frappe.handler import execute_cmd if frappe.conf.disable_async: return execute_cmd(cmd, from_async=True) args = frappe._dict(args) task = run_async_task.delay( site=frappe.local.site, user=(frappe.session and frappe.session.user) or "Administrator", cmd=cmd, form_dict=args, ) if set_in_response: frappe.local.response["task_id"] = task.id return task.id
def test_response(self): result = run_async_task.delay(frappe.local.site, "Administrator", "async_ping", frappe._dict()) result = result.get() self.assertEquals(result.get("message"), "pong")