Okay, I changed the process method and add arguments as below:
@classmethod
def write(cls, records, values, *args):
#--- a lot of code -----
cls.__queue__.process(list([1]))
return result
def process(cls, values):
logger.info(f">>>>>>>>>>>>>>>>>>>>>>>>> EXECUTING PROCESS {values}")
pool = Pool()
#--- Below method call are the most important thing
#--- because the whole idea of using this queue is to
#--- delegate the execution of below class methods
#--- outside the main thread
ProjectAllocation = pool.get('afx.project.allocation')
ProjectAllocation.update_project_allocation_records()
and now the record in ir.queue become like below:
{"args": [], "user": 1, "model": "afx.project", "kwargs": {}, "method": "process",
"context": {"client": "863512e1-9e70-4d99-889b-d578e191d62d",
"groups": [1, 772, 773, 774, 701, 702, 466, 464, 467, 703, 704, 472, 465,
468, 469, 778, 470, 471], "company": 1, "_request": {"scheme": "http",
"http_host": "localhost:8000", "is_secure": false, "remote_addr": "127.0.0.1"},
"employee": 1, "company_filter": "one", "click_my_projects": "1",
"company_work_time": {"M": 576000, "Y": 6912000, "d": 28800, "h": 3600, "m": 60,
"s": 1, "w": 144000}, "language_direction": "ltr"}, "instances": [1]}
But event thou this process method may be called via Queue… the codes within the process method aren’t executed, which is the most important thing.
Bromo