This is probably a stupid question but its got me stumped coming from a Ruby background.
I have an object that looks like this when I try to print it.
print celery.AsyncResult.task_id
>>><property object at 0x10c383838>
I was expecting the actual value of the task_id property to be printed here. How do I get to the actual value?
UPDATE 1
@celery.task
def scan(host):
print celery.AsyncResult.task_id
cmd = 'ps -ef'
cm = shlex.split(cmd)
scan = subprocess.check_output(cm)
return scan
Best Regards.
Short story, within function scan
, use scan.request.id
.
See http://docs.celeryproject.org/en/latest/userguide/tasks.html?highlight=request#task-request-info