-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from Miksus/docs/updates
DOCS: Minor documentation improvement
- Loading branch information
Showing
7 changed files
with
205 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
.highlight-py .k { | ||
/*Keyword*/ | ||
color: #3f6ec6; | ||
} | ||
|
||
.highlight-py .kn { | ||
/*Keyword (import)*/ | ||
color: #3f6ec6; | ||
} | ||
|
||
.highlight-py .nn { | ||
/*Module*/ | ||
color: #a846b9; | ||
} | ||
|
||
.highlight-py .nd { | ||
/*Decorator*/ | ||
color: #3f6ec6; | ||
} | ||
|
||
.highlight-py .nf { | ||
/*Function name*/ | ||
color: #000000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ how the tasks works and how to change their behaviour. | |
|
||
termination | ||
execution | ||
observer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Observer Task | ||
============= | ||
|
||
Observer tasks are tasks that are running constantly | ||
on the side. Observer tasks can be used for: | ||
|
||
- Monitoring the system | ||
- Hosting user interface or polling user inputs | ||
- Polling events or updates | ||
|
||
Observer tasks are characterized as tasks that | ||
are not expected to complete and don't have | ||
timeouts. Unlike other tasks, observer tasks are | ||
always immediately terminated when shutting down | ||
the scheduler regardless of the shutdown settings. | ||
|
||
To set a task as an observer task, set ``permanent`` | ||
as ``True``: | ||
|
||
.. code-block:: python | ||
@app.task(permanent=True) | ||
def monitor(): | ||
while True: | ||
... | ||
.. note:: | ||
|
||
If you use threaded execution for observer task, | ||
you should periodically check the termination flag | ||
status: | ||
|
||
.. code-block:: python | ||
from rocketry.args import TerminationFlag | ||
from rocketry.exc import TaskTerminationException | ||
@app.task(permanent=True) | ||
def monitor(flag=TerminationFlag()): | ||
while not flag.is_set(): | ||
... | ||
raise TaskTerminationException() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters