简体   繁体   中英

How do I know much time taken by task?

I am using celery, task is differed using task.delay() function. I would like keep log of every task and time taken to finish.

Is there anyway so that I could how much time taken?

In the celery console log, we can see time taken by a task eg

[2015-12-09 20:13:33,745: INFO/MainProcess] Task start1.add[51563981-432e-423b-b63f-63c980145c8e] succeeded in 0.010178387004998513s: 5

Here 0.010178387004998513s is time taken to finish a task. Is there any way I can capture this variable so that I can store it somewhere?

Thanks

there may be an answer for your problem:

Send log messages from all celery tasks to a single file

again, need to make it clear that the log you see from console is the log of celery process , celery itself has no ways to log different tasks' log, you have to log that explicitly in the task code snippet.

thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM