Estoy tratando de ejecutar una función a través de rq worker. Este es el error que me sale:
objc[4463]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. objc[4463]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug. 16:35:40 Moving job to FailedJobRegistry (work-horse terminated unexpectedly; waitpid returned 6)Así es como estoy agregando la tarea en la cola. Es la ruta Fast Api
r=RedisQueue.get_redis() q=Queue(connection=r) job=q.enqueue(export_testcases_to_xlsx,testcases,token) RedisQueue.get_worker(r)Tengo un archivo redisqueue.py que es así:
import redis from rq import Queue,Connection,Worker from rq.job import Job from app.model.Settings import Settings import sys,os settings=Settings() class RedisQueue: @staticmethod def get_redis(): # To run on container if settings.redis_host: r = redis.Redis(host=settings.redis_host, port=settings.redis_port) # To run locally else: r = redis.Redis() return r def get_worker(r): listen = ['default'] with Connection(r): worker = Worker(list(map(Queue, listen))) worker.work()Cuando no inicio el trabajador a través de la función get_worker y uso directamente el comando rq worker en la terminal para iniciar el trabajador, funciona bien.