TaskExec¶
TaskPriority and TaskExec Schema.
TaskExecSchema
dataclass
¶
TaskExecSchema schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
priority
|
int
|
Priority. |
required |
name
|
str
|
Name. |
required |
func
|
FunctionType
|
Task function. |
required |
awaiting
|
bool
|
Asynchronous task. Default: |
False
|
generating
|
str | Literal[False]
|
Generating a task. Default: |
False
|
echo
|
bool
|
Include the self parameter in the task. Default: |
False
|
max_time
|
float
|
The maximum time the task will take to complete in seconds. Default: |
None
|
retry
|
int
|
Number of attempts to retry the task. Default: |
None
|
retry_on_exc
|
List[Type[Exception]]
|
Exceptions under which the task will be re-executed. Default: |
None
|
decode
|
Callable
|
Decoder of the task result. Default: |
None
|
tags
|
List[str]
|
Task tags. Default: |
None
|
description
|
str
|
Description of the task. Default: |
None
|
generate_handler
|
Callable
|
Handler generator. Default: |
None
|
executor
|
Type[BaseTaskExecutor]
|
Class |
None
|
middlewares_before
|
List[Type[TaskMiddleware]]
|
Middleware before the task is executed. Default: |
list()
|
middlewares_after
|
List[Type[TaskMiddleware]]
|
Middleware after task execution. Default: |
list()
|
extra
|
Dict[str, Any]
|
Additional task parameters. Default: |
dict()
|
Source code in src/qtasks/schemas/task_exec.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
add_middlewares_after(middlewares)
¶
Adds a middleware to a task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
middlewares
|
List[Type[TaskMiddleware]]
|
List of middlewares. |
required |
Source code in src/qtasks/schemas/task_exec.py
108 109 110 111 112 113 114 | |
add_middlewares_before(middlewares)
¶
Adds a middleware to a task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
middlewares
|
List[Type[TaskMiddleware]]
|
List of middlewares. |
required |
Source code in src/qtasks/schemas/task_exec.py
100 101 102 103 104 105 106 | |
TaskPrioritySchema
dataclass
¶
TaskPrioritySchema schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
priority
|
int
|
Priority. |
required |
uuid
|
UUID
|
UUID. |
required |
name
|
str
|
Name. |
required |
args
|
Tuple[str]
|
Arguments of type args. |
list()
|
kwargs
|
Dict[str, str]
|
Arguments of type kwargs. |
dict()
|
created_at
|
float
|
Created date in |
0.0
|
updated_at
|
float
|
Update date in |
0.0
|
Source code in src/qtasks/schemas/task_exec.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |