芹菜记录器有问题。我有一个渲染帧的函数。我记录了我产生的子进程的输出,但似乎只有每个工人从队列中选出的第一个作业被写入。队列中的所有后续任务都不会生成日志文件。我已经尝试使用python自己的日志记录以及相同的问题发生。有没有可能丢失的配置?芹菜任务记录器不写
@task(queue='rndr')
def rndr(params):
path = get_logger_path(params)
logger = rndr.get_logger(logfile=path)
return render(params, logger)
我定义,因为我重试记录将被不同的定义,即rndr_retry.get_logger ...
我celeryconfig看起来像下面我的任务是这样的:
BROKER_HOST = "xxx.xxx.xxx.xxx"
BROKER_PORT = 5672
BROKER_USER = "xxxx"
BROKER_PASSWORD = "xxxx"
CELERY_RESULT_BACKEND = 'amqp'
CELERY_DISABLE_RATE_LIMITS = True
CELERY_ACKS_LATE = True
CELERY_IMPORTS = ['lib.tasks.concatenate', 'lib.tasks.encode', 'lib.tasks.render', 'lib.tasks.still_image', 'lib.tasks.retry']
CELERY_ROUTES = {'lib.tasks.encode':{'queue': 'encode'},
'lib.tasks.concatenate':{'queue': 'encode'},
'lib.tasks.still_image':{'queue': 'encode'},
'lib.tasks.render':{'queue':'rndr'},
'lib.tasks.retry':{'queue': 'retry'}
}
希望有人能关于为什么只有第一个任务关闭队列写入...
谢谢你提前。
更新:这里要求的渲染方法的部分版本没有所有的细节问题细节...
def render(params, logger):
#load params to local values
try:
#create subprocess
output = child_proc.communicate()[0]
logger.info('output')
logger.info(output)
ret = child_proc.wait()
if ret not in [0,1]:
raise Exception('subprocess failed')
except Exception, exc:
logger.info(' '.join(str(x) for x in exc.args))
#mark as failed...
return
return
我要补充一点,不仅在文件没有得到在后续任务编写的,它不甚至不会创建日志文件....
请注意,芹菜记录器是一样的事情,蟒蛇记录器;芹菜使用引擎盖下的'logging'模块。 –
啊,是的,我也读过。我不确定它为什么会在第一个队列中工作,然后停下来...... – deecodameeko
您可能需要共享'render'的代码,或者至少是该方法的一个很好的近似值;这里说什么都太少了。 –