title: how to get the queue in which a task was run - celery
body: <p>I'm new using celery and have a question. I have this simple task:</p>
  
  <pre><code>@app.task(name='test_install_queue')
  def test_install_queue():
      return subprocess.call("exit 0",shell=True)
  </code></pre>
  
  <p>and I am calling this task later in a test case like</p>
  
  <pre><code>result = tasks.test_default_queue.apply_async(queue="install")
  </code></pre>
  
  <p>The task run successfully in the queue <code>install</code> (because I am seeing it in the celery log, and it completes fine. But I would like to know a programmatically way of finding in which queue was the task <code>test_install_queue</code> run, from the object stored in <code>result</code>.</p>
  
  <p>Thank you!</p>
  
  <p>EDIT:</p>
  
  <p>I've changed the tasks to be like:</p>
  
  <pre><code>@app.task(name='test_install_queue',bind=True)
  def test_install_queue(self):
      return self.request.__dict__
  </code></pre>
  
  <p>and then I'm using the result of <code>apply_async</code> as follows:</p>
  
  <pre><code>result = tasks.test_install_queue.apply_async(queue="install")
  assert "install" in result.get()["hostname"]
  </code></pre>
  
  <p>and the workaround is that the worker (hostname) has the same name as the only queue that is initialized in the worker.</p>