Tasks
albert.collections.tasks.TaskCollection
Bases: BaseCollection
TaskCollection is a collection class for managing Task entities in the Albert platform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
AlbertSession
|
The Albert Session information |
required |
Methods:
Name | Description |
---|---|
create |
Create a new task. Tasks can be of different types, such as PropertyTask, and are created using the provided task object. |
add_block |
Add a block to a Property task. |
update_block_workflow |
Update the workflow of a specific block within a task. |
remove_block |
Remove a block from a Property task. |
delete |
Delete a task. |
get_by_id |
Retrieve a task by its ID. |
list |
Search for tasks matching the given criteria. |
update |
Update a task. |
get_history |
|
Attributes:
Name | Type | Description |
---|---|---|
base_path |
|
Source code in src/albert/collections/tasks.py
create
Create a new task. Tasks can be of different types, such as PropertyTask, and are created using the provided task object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
BaseTask
|
The task object to create. |
required |
Returns:
Type | Description |
---|---|
BaseTask
|
The registered task object. |
Source code in src/albert/collections/tasks.py
add_block
add_block(
*,
task_id: TaskId,
data_template_id: DataTemplateId,
workflow_id: WorkflowId,
) -> None
Add a block to a Property task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
TaskId
|
The ID of the task to add the block to. |
required |
data_template_id
|
DataTemplateId
|
The ID of the data template to use for the block. |
required |
workflow_id
|
WorkflowId
|
The ID of the workflow to assign to the block. |
required |
Returns:
Type | Description |
---|---|
None
|
This method does not return any value. |
Source code in src/albert/collections/tasks.py
update_block_workflow
update_block_workflow(
*,
task_id: TaskId,
block_id: BlockId,
workflow_id: WorkflowId,
) -> None
Update the workflow of a specific block within a task.
This method updates the workflow of a specified block within a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The ID of the task. |
required |
block_id
|
str
|
The ID of the block within the task. |
required |
workflow_id
|
str
|
The ID of the new workflow to be assigned to the block. |
required |
Returns:
Type | Description |
---|---|
None
|
This method does not return any value. |
Notes
- The method asserts that the retrieved task is an instance of
PropertyTask
. - If the block's current workflow matches the new workflow ID, no update is performed.
- The method handles the case where the block has a default workflow named "No Parameter Group".
Source code in src/albert/collections/tasks.py
remove_block
Remove a block from a Property task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
ID of the Task to remove the block from (e.g., TASFOR1234) |
required |
block_id
|
str
|
ID of the Block to remove (e.g., BLK1) |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in src/albert/collections/tasks.py
delete
delete(*, id: TaskId) -> None
Delete a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
TaskId
|
The ID of the task to delete. |
required |
get_by_id
Retrieve a task by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id
|
TaskId
|
The ID of the task to retrieve. |
required |
Returns:
Type | Description |
---|---|
BaseTask
|
The task object with the provided ID. |
Source code in src/albert/collections/tasks.py
list
list(
*,
order: OrderBy = DESCENDING,
text: str | None = None,
sort_by: str | None = None,
tags: list[str] | None = None,
task_id: list[str] | None = None,
linked_task: list[str] | None = None,
category: TaskCategory | None = None,
albert_id: list[str] | None = None,
data_template: list[str] | None = None,
assigned_to: list[str] | None = None,
location: list[str] | None = None,
priority: list[str] | None = None,
status: list[str] | None = None,
parameter_group: list[str] | None = None,
created_by: list[str] | None = None,
project_id: str | None = None,
limit: int = 100,
offset: int = 0,
) -> Iterator[BaseTask]
Search for tasks matching the given criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
order
|
OrderBy
|
The order in which to return results, by default OrderBy.DESCENDING |
DESCENDING
|
text
|
str | None
|
The text to search for, by default None |
None
|
sort_by
|
str | None
|
The attribute to sort by, by default None |
None
|
tags
|
list[str] | None
|
The tags to search for, by default None |
None
|
task_id
|
list[str] | None
|
The related task IDs to search for, by default None |
None
|
linked_task
|
list[str] | None
|
The Linked Task IDs to search for, by default None |
None
|
category
|
TaskCategory | None
|
The category of the task to search for, by default None |
None
|
albert_id
|
list[str] | None
|
The Albert IDs to search for, by default None |
None
|
data_template
|
list[str] | None
|
The data template IDs to search for, by default None |
None
|
assigned_to
|
list[str] | None
|
The User IDs to search for, by default None |
None
|
location
|
list[str] | None
|
The Locations names to search for, by default None |
None
|
priority
|
list[str] | None
|
The Priority levels to search for, by default None |
None
|
status
|
list[str] | None
|
The Task Statuses to search for, by default None |
None
|
parameter_group
|
list[str] | None
|
The related Parameter Group IDs to search for, by default None |
None
|
created_by
|
list[str] | None
|
The User IDs of the task creators to search for, by default None |
None
|
project_id
|
str | None
|
The Project ID to search for, by default None |
None
|
Yields:
Type | Description |
---|---|
Iterator[BaseTask]
|
An iterator of matching Task objects. |
Source code in src/albert/collections/tasks.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
|
update
Update a task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
BaseTask
|
The updated Task object. |
required |
Returns:
Type | Description |
---|---|
BaseTask
|
The updated Task object as it exists in the Albert platform. |
Source code in src/albert/collections/tasks.py
get_history
get_history(
*,
id: TaskId,
order: OrderBy = DESCENDING,
limit: int = 1000,
entity: HistoryEntity | None = None,
blockId: str | None = None,
startKey: str | None = None,
) -> TaskHistory