mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 14:58:13 +08:00
Add broker name in Schedule docs
This commit is contained in:
+7
-1
@@ -28,10 +28,11 @@ You can manage them through the :ref:`admin_page` or directly from your code wit
|
|||||||
)
|
)
|
||||||
|
|
||||||
# In case you want to use q_options
|
# In case you want to use q_options
|
||||||
|
# Specify the broker by using the property broker_name in q_options
|
||||||
schedule('math.sqrt',
|
schedule('math.sqrt',
|
||||||
9,
|
9,
|
||||||
hook='hooks.print_result',
|
hook='hooks.print_result',
|
||||||
q_options={'timeout': 30},
|
q_options={'timeout': 30, 'broker_name': 'broker_1'},
|
||||||
schedule_type=Schedule.HOURLY)
|
schedule_type=Schedule.HOURLY)
|
||||||
|
|
||||||
# Run a schedule every 5 minutes, starting at 6 today
|
# Run a schedule every 5 minutes, starting at 6 today
|
||||||
@@ -118,6 +119,11 @@ Reference
|
|||||||
:param dict q_options: options passed to async_task for this schedule
|
:param dict q_options: options passed to async_task for this schedule
|
||||||
:param kwargs: optional keyword arguments for the scheduled function.
|
:param kwargs: optional keyword arguments for the scheduled function.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
q_options does not accept the 'broker' key with a broker instance but accepts a 'broker_name' key instead. This can be used to specify the broker connection name to assign the task. If a broker with the specified name does not exist or is not running at the moment of placing the task in queue it fallbacks to the random broker/queue that handled the schedule.
|
||||||
|
|
||||||
|
|
||||||
.. class:: Schedule
|
.. class:: Schedule
|
||||||
|
|
||||||
A database model for task schedules.
|
A database model for task schedules.
|
||||||
|
|||||||
Reference in New Issue
Block a user