mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 13:18:11 +08:00
Update README.rst
This commit is contained in:
+22
-4
@@ -114,10 +114,6 @@ Async
|
|||||||
|
|
||||||
Use async from your code to quickly offload tasks:
|
Use async from your code to quickly offload tasks:
|
||||||
|
|
||||||
.. code:: python
|
|
||||||
|
|
||||||
async(func,*args,hook=None,**kwargs)
|
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
from django_q import async, result
|
from django_q import async, result
|
||||||
@@ -142,6 +138,15 @@ Use async from your code to quickly offload tasks:
|
|||||||
def print_result(task):
|
def print_result(task):
|
||||||
print(task.result)
|
print(task.result)
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
async(func,*args,**kwargs)
|
||||||
|
|
||||||
|
- **func**: Function to execute. Dotted string or reference.
|
||||||
|
- **args**: Optional arguments for the function.
|
||||||
|
- **hook**: Optional function to call after execution. Dotted string or reference.
|
||||||
|
- **kwargs**: Optional keyword arguments for the function.
|
||||||
|
|
||||||
Schedule
|
Schedule
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
@@ -167,6 +172,19 @@ Admin page or directly from your code:
|
|||||||
schedule_type=Schedule.DAILY
|
schedule_type=Schedule.DAILY
|
||||||
)
|
)
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
schedule(func,*args,**kwargs)
|
||||||
|
|
||||||
|
- **func**: the function to schedule. Dotted strings only.
|
||||||
|
- **args**: arguments for the scheduled function.
|
||||||
|
- **hook**: optional result hook function. Dotted strings only.
|
||||||
|
- **schedule_type**: (O)nce, (H)ourly, (D)aily, (W)eekly, M(onthly), Q(uarterly), Y(early)
|
||||||
|
- **repeats**: Number of times to repeat schedule. -1=Always, 0=Never, n=n.
|
||||||
|
- **next_run**: Next or first scheduled execution datetime.
|
||||||
|
- **kwargs**: optional keyword arguments for the scheduled function.
|
||||||
|
|
||||||
|
|
||||||
Models
|
Models
|
||||||
~~~~~~
|
~~~~~~
|
||||||
- `Task` and `Schedule` are Django Models and can therefore be managed by your own code.
|
- `Task` and `Schedule` are Django Models and can therefore be managed by your own code.
|
||||||
|
|||||||
Reference in New Issue
Block a user