0

I put Celery in my Django app so that the two other python programs can process the input from my Django app via doing subprocess method. My question is how do I access the output from the subprocess? Back then when I made just a python program, I access the log files (output from the two apps) via stdout and stderr. Is this the same when I use Celery in Django? Is the value of CELERY_RESULT_BACKEND (if I should assign my Django app's db here) affected by the log files?

So far what I've done is:

  1. Access the two apps via subprocess in my tasks.py

  2. I assigned my broker's db, Redis, as my db for now for CELERY_RESULT_BACKEND. My plan is to get the log files and then save them to my Django app's db so that I can just access that db.

Can you offer some help?

sparklights
  • 97
  • 1
  • 1
  • 9

1 Answers1

0

Typically, you only care about the task result, which is the return value of the celery task, and that is stored in your result_backend for at least result_expires time (usually 1 day). So, to the extent that you want to access any particular task's result, you can just do so using the task ID.

2ps
  • 15,099
  • 2
  • 27
  • 47
  • Well the return values are there. If you are looking for debugging statements and when the task was received and the like, you may not get that information. But you can access Result/Task metadata and the Task return value. – 2ps Jan 14 '17 at 15:48
  • Ah, ok, I get it now. If this does not work, maybe I can control the value of the stdout and stderr. :D Thanks! – sparklights Jan 14 '17 at 16:26
  • ** I deleted my first comment, sorry, didn't saw your reply before. Thanks for your reply! – sparklights Jan 14 '17 at 16:28