Skip to content

Commit

Permalink
Merge pull request #334 from akvadrako/patch-1
Browse files Browse the repository at this point in the history
Add package.module:callable syntax to Mules.rst
  • Loading branch information
xrmx committed Oct 19, 2016
2 parents 4ad93bd + e71046e commit f7ff115
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Mules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ Basic usage
Giving a brain to mules
-----------------------

As mentioned before, mules can be programmed. To give custom logic to a mule, pass the name of a script to the ``mule`` option.
As mentioned before, mules can be programmed. To give custom logic to a mule, give the ``mule`` option a path to
a script (it must end in ".py") or a "package.module:callable" value.

.. code-block:: sh
uwsgi --socket :3031 --mule=somaro.py --mule --mule --mule
uwsgi --socket :3031 --mule=somaro.py --mule=mypkg.myapp:run_mule --mule --mule
This will run 4 mules, 3 in signal-only mode and one running :file:`somaro.py`.
This will run 4 mules, 2 in signal-only mode, one running :file:`somaro.py` and one running `mypkg.myapp:run_mule`.

.. code-block:: py
Expand Down Expand Up @@ -102,4 +103,4 @@ Use :py:meth:`uwsgi.mule_msg` to send a message to a programmed mule. Mule messa
# If you do not specify a mule ID, the message will be processed by the first available programmed mule.
uwsgi.mule_msg("ciuchino", 1)
As you can spawn an unlimited number of mules, you may need some form of synchronization -- for example if you are developing a task management subsystem and do not want two mules to be able to start the same task simultaneously. You're in luck -- see :doc:`Locks`.
As you can spawn an unlimited number of mules, you may need some form of synchronization -- for example if you are developing a task management subsystem and do not want two mules to be able to start the same task simultaneously. You're in luck -- see :doc:`Locks`.

0 comments on commit f7ff115

Please sign in to comment.