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.
In order to make your tasks more "OO-like", you could use the bind argument to get a reference to self:
@celery.task(bind=True)
def scan(self, host):
print self.request.id
Please note that self.request.id is actually an instance of AsyncTask. In order to have the task id as a string, you should do self.request.id.__str__().
From Celery's documentation (after the example):
The
bindargument means that the function will be a “bound method” so that you can access attributes and methods on the task type instance.