ironmq.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. .. _broker-ironmq:
  2. ==================
  3. Using IronMQ
  4. ==================
  5. .. _broker-ironmq-installation:
  6. Installation
  7. ============
  8. For IronMQ support, you'll need the :pypi:`iron_celery` library:
  9. .. code-block:: console
  10. $ pip install iron_celery
  11. As well as an `Iron.io account <Iron.io>`_. Sign up for free at `Iron.io`_.
  12. _`Iron.io`: http://www.iron.io/
  13. .. _broker-ironmq-configuration:
  14. Configuration
  15. =============
  16. First, you'll need to import the iron_celery library right after you
  17. import Celery, for example:
  18. .. code-block:: python
  19. from celery import Celery
  20. import iron_celery
  21. app = Celery('mytasks', broker='ironmq://', backend='ironcache://')
  22. You have to specify IronMQ in the broker URL:
  23. .. code-block:: python
  24. broker_url = 'ironmq://ABCDEFGHIJKLMNOPQRST:ZYXK7NiynGlTogH8Nj+P9nlE73sq3@'
  25. where the URL format is:
  26. .. code-block:: text
  27. ironmq://project_id:token@
  28. you must *remember to include the "@" at the end*.
  29. The login credentials can also be set using the environment variables
  30. :envvar:`IRON_TOKEN` and :envvar:`IRON_PROJECT_ID`, which are set automatically
  31. if you use the IronMQ Heroku add-on. And in this case the broker URL may only be:
  32. .. code-block:: text
  33. ironmq://
  34. Clouds
  35. ------
  36. The default cloud/region is ``AWS us-east-1``. You can choose the IronMQ Rackspace (ORD)
  37. cloud by changing the URL to:
  38. .. code-block:: text
  39. ironmq://project_id:token@mq-rackspace-ord.iron.io
  40. Results
  41. =======
  42. You can store results in IronCache with the same ``Iron.io`` credentials,
  43. just set the results URL with the same syntax
  44. as the broker URL, but changing the start to ``ironcache``:
  45. .. code-block:: text
  46. ironcache:://project_id:token@
  47. This will default to a cache named "Celery", if you want to change that:
  48. .. code-block:: text
  49. ironcache:://project_id:token@/awesomecache
  50. More Information
  51. ================
  52. You can find more information in the `iron_celery README`_.
  53. _`iron_celery README`: https://github.com/iron-io/iron_celery/