django-orchestra/orchestra/contrib/tasks/utils.py
Santiago L 9d2d0befc4 Rename async--> run_async
On Python3.5 async becames a reserved keyword.
2021-03-30 12:51:12 +02:00

20 lines
444 B
Python

import threading
from uuid import uuid4
from orchestra.utils.db import close_connection
def get_id():
return str(uuid4())
def get_name(fn):
return '.'.join((fn.__module__, fn.__name__))
def run(method, *args, **kwargs):
run_async = kwargs.pop('run_async', True)
thread = threading.Thread(target=close_connection(method), args=args, kwargs=kwargs)
thread = Process(target=close_connection(counter))
thread.start()