Tasks
albert.collections.tasks.TaskCollection
Bases: BaseCollection
Manage Tasks in the Albert platform.
A Task is a unit of lab work. There are three kinds, and choosing the right one matters:
- PropertyTask: test and document the properties of products/formulas or raw materials. This is the task type that captures measured Property Data. A PropertyTask holds one or more Blocks, each pairing a Data Template (the results to capture) with a Workflow (the conditions to run under).
- BatchTask: manufacture a batch within Albert after creating a new formulation.
- GeneralTask: anything else happening in the lab that is not a batch or property task (e.g. equipment calibration). Has no blocks.
Typical PropertyTask flow: create the task, attach a Block with
add_block (a Data Template + a Workflow), then record results through
the Property Data collection
(PropertyDataCollection). Measured
results roll up to the associated inventory item's properties.
This collection is accessed as client.tasks.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for task requests. |
Methods:
| Name | Description |
|---|---|
create |
Create a PropertyTask, BatchTask, or GeneralTask. |
create_many |
Create multiple tasks in a single call. |
create_with_combinations |
Create a Property or Batch task and generate its block combinations (increased intervals). |
get_by_id |
Get a single fully populated task by its ID. |
search |
Fast, lightweight search returning partial tasks. |
get_all |
Same filters as search, but returns fully populated tasks. |
update |
Update an existing task. |
allocate_inventory |
Record how much inventory a task consumed (allocate inventory / assign lots). |
delete |
Delete a task by its ID. |
add_block |
Add a Block (Data Template + Workflow) to a Property or Batch task. |
add_blocks |
Add multiple Blocks to a task in one call. |
remove_block |
Remove a Block from a Property or Batch task. |
update_block_workflow |
Swap the Workflow assigned to a Block. |
update_task_workflow |
Swap the Workflow assigned to a batch task. |
get_block_combinations |
Get the child-workflow combinations of a block. |
get_block_rules |
Get combination rules and overrides for a block. |
set_block_rules |
Set combination rules and overrides for a block, automatically regenerating combinations. |
add_block_inventory_exclusions |
Mask inventory x combination pairs on a block. |
remove_block_inventory_exclusions |
Unmask inventory x combination pairs on a block. |
generate_block_combinations |
Generate child-workflow interval combinations for a task block. |
import_results |
Import measured results into a Property task from a file or attachment. |
get_history |
Get a task's audit history. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/tasks.py
create
create(
*,
task: PropertyTask | GeneralTask | BatchTask,
wait: bool = True,
) -> BaseTask
Create a new task.
Pass the concrete task type you want to create. Its category is set
automatically by the type, so the platform routes it correctly:
PropertyTask: test/document properties.BatchTask: manufacture a batch.GeneralTask: any other lab work.
For a PropertyTask, set parent_id to the parent Project ID. Blocks can be
set on the task's blocks or added after creation with
add_block.
When increased intervals is enabled for your tenant, the interval combinations
of every block of a Property or Batch task are generated before create
returns, so the blocks are ready for results. This adds the generation time to
the call, with at least 10 seconds between blocks of the task. Pass
wait=False to return as soon as generation has started. To set combination
rules or overrides on the blocks, use
create_with_combinations
instead.
Lifecycle state on create is coupled to the assignee:
- No
assigned_to: the task startsUnclaimed. A missingstateis defaulted for you, andNot Started/In Progressare rejected, since a task cannot be in progress with no one assigned. Explicit terminal states (Completed,Closed,Cancelled) are preserved for ingestion flows. - With
assigned_to: the task startsNot Started.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
PropertyTask or GeneralTask or BatchTask
|
The task to create. |
required |
wait
|
bool
|
Whether to wait until the interval combinations of the task's blocks are generated, when increased intervals is enabled for your tenant. If False, returns as soon as generation has started. |
True
|
Returns:
| Type | Description |
|---|---|
BaseTask
|
The created task (a |
Raises:
| Type | Description |
|---|---|
AlbertException
|
If |
CombinationGenerationError
|
If combinations could not be generated for one or more blocks. The task was
created anyway ( |
Source code in src/albert/collections/tasks.py
234 235 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 | |
create_many
create_many(
*,
tasks: list[PropertyTask | GeneralTask | BatchTask],
wait: bool = True,
) -> list[BaseTask]
Create multiple tasks in a single call.
All tasks must share the same category (mixing task types is not
supported) and, when set, the same parent_id.
Lifecycle state on create follows the same rule as
create: a task without
assigned_to starts Unclaimed (a missing state is defaulted, and
Not Started / In Progress are rejected), while a task with an
assignee starts Not Started.
When increased intervals is enabled for your tenant, the interval combinations
of every block of the created Property or Batch tasks are generated before
create_many returns, as with
create. Pass wait=False
to return as soon as generation has started.
Example
from albert.resources.tasks import GeneralTask
location = next(client.locations.get_all(max_items=1))
tasks = client.tasks.create_many(
tasks=[
GeneralTask(name="Calibrate balance", location=location),
GeneralTask(name="Clean hood", location=location),
]
)
[t.id for t in tasks]
# ['TASGEN1', 'TASGEN2']
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tasks
|
list[PropertyTask or GeneralTask or BatchTask]
|
The tasks to create. Must be non-empty and share one category and
one |
required |
wait
|
bool
|
Whether to wait until the interval combinations of the tasks' blocks are generated, when increased intervals is enabled for your tenant. If False, returns as soon as generation has started. |
True
|
Returns:
| Type | Description |
|---|---|
list[BaseTask]
|
The created tasks, in request order, populated with their assigned
Task IDs. Blocks whose combinations were generated carry |
Raises:
| Type | Description |
|---|---|
AlbertException
|
If |
CombinationGenerationError
|
If combinations could not be generated for one or more blocks. All tasks
were created anyway ( |
Source code in src/albert/collections/tasks.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
create_with_combinations
create_with_combinations(
*, task: PropertyTask | BatchTask, wait: bool = True
) -> PropertyTask | BatchTask
Create a Property or Batch task and generate interval combinations across all its blocks.
Use this method to create a Property or Batch task whose blocks need combination
rules or overrides, or workflows defined inline, when increased intervals is
enabled for your tenant.
create also generates the
combinations of every block, but without rules or overrides.
PropertyTask and
BatchTask are supported, and only
when increased intervals is enabled; otherwise the task is rejected and not
created, so use create
instead. Albert enables increased intervals per tenant; if you're unsure
whether it's enabled for yours, contact your Albert representative.
Provides an all-in-one method to create a Property or Batch task and materialize child-workflow combination variants across every task block.
Intervals, Modes, Rules, and Overrides:
- Intervals and Cartesian Product: When workflow parameters define discrete setpoints (intervals), Albert computes the Cartesian product across every intervalized parameter. Each combination materializes as an independent child workflow record linked to the task block with a unique, persistent interval barcode.
- Starting Baseline (
intervals_start_from): - Exclude Mode (
"all", default): starts with all possible Cartesian product variants active. Rules and overrides prune out infeasible, unsafe, or unwanted combinations. - Include Mode (
"none"): starts with zero active combinations (an empty set). Rules and overrides selectively pull in combinations, ideal for sparse screening or targeted Designs of Experiment (DoE). - Rules (Criteria-Based Filtering): Rules dynamically evaluate combination variants against criteria defined on parameter values. All conditions within a single rule must match (AND logic). If any rule on the block triggers (OR logic), the combination is excluded (in Exclude Mode) or included (in Include Mode).
- Overrides (Targeted Setpoint Overrides):
Overrides target a single, specific combination identified by its exact parameter values:
action="skip"explicitly excludes the variant, whileaction="unskip"keeps or forces its inclusion. In Include Mode ("none"), setis_manual=Trueto designate a manually cherry-picked combination. Overrides are evaluated first and always take precedence over rules.
Execution Steps:
- Automatically saves any unsaved
Workflowobjects defined on the task blocks, preserving block ordering. - Sets
intervals_start_from="all"(Exclude Mode) on any blocks where the mode is not explicitly configured. - Creates the task and saves any configured block rules (
ExclusionRule) or overrides (CombinationOverride). - Sequentially triggers combination generation for each block, pacing requests to ensure steady platform processing.
- If
wait=True(the default), waits for combination generation to complete across all blocks and returns the refreshed task with combination details populated. Ifwait=False, returns immediately after launching generation, leaving job tracking identifiers on each block.
To view the generated combinations after creation, use
get_block_combinations.
To update rules or regenerate combinations on an existing task later, use
set_block_rules and
generate_block_combinations.
Example
from albert import Albert
from albert.resources.tasks import Block, PropertyTask
client = Albert()
task = client.tasks.create_with_combinations(
task=PropertyTask(
name="Viscosity screen",
parent_id="PROA123",
blocks=[
Block(
data_template=[{"id": "DAT123"}],
workflow=[{"id": "WFL456"}],
),
],
),
wait=True,
)
task.id
# 'TASFOR1'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
PropertyTask or BatchTask
|
required | |
wait
|
bool
|
Whether to wait for combination generation to complete across all blocks. If False, returns immediately after submitting generation jobs. |
True
|
Returns:
| Type | Description |
|---|---|
PropertyTask or BatchTask
|
The created task. If |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
CombinationGenerationError
|
If combination generation could not be started, or with |
Source code in src/albert/collections/tasks.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |
add_block
add_block(
*,
task_id: TaskId,
data_template_id: DataTemplateId,
workflow_id: WorkflowId,
wait: bool = True,
) -> BlockId
Add a Block to a Property or Batch task.
A Block pairs a Data Template (the results/data columns to capture) with a Workflow (the parameter conditions to run under). A task can hold multiple blocks, e.g. one per test. Once a block exists, results are written against it through the Property Data collection.
When increased intervals is enabled for your tenant, the block's interval
combinations are generated before add_block returns, so the block is ready
for results. Pass wait=False to return as soon as generation has started.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The task to add the block to (format |
required |
data_template_id
|
DataTemplateId
|
The Data Template supplying the block's results/data columns
(format |
required |
workflow_id
|
WorkflowId
|
The Workflow supplying the block's parameter conditions
(format |
required |
wait
|
bool
|
Whether to wait until the block's interval combinations are generated, when increased intervals is enabled for your tenant. If False, returns as soon as generation has started. |
True
|
Returns:
| Type | Description |
|---|---|
BlockId
|
The ID of the added block (format |
Raises:
| Type | Description |
|---|---|
CombinationGenerationError
|
If the block's combinations could not be generated. The block was added
anyway: retry with
|
See Also
remove_block : Remove a block from a task. update_block_workflow : Change the workflow on an existing block.
Source code in src/albert/collections/tasks.py
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | |
add_blocks
Add multiple Blocks to a Property or Batch task in one call.
Each Block pairs a Data Template (the results/data columns to capture)
with a Workflow (the parameter conditions to run under), exactly as with
add_block; only
the block's workflow and data template IDs are used.
When increased intervals is enabled for your tenant, the interval combinations
of every added block are generated before add_blocks returns, with at least
10 seconds between blocks. Pass wait=False to return as soon as generation
has started.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The task to add the blocks to (format |
required |
blocks
|
list[Block]
|
The blocks to add. Build each with a single Workflow and a single Data Template referenced by ID. |
required |
wait
|
bool
|
Whether to wait until the blocks' interval combinations are generated, when increased intervals is enabled for your tenant. If False, returns as soon as generation has started. |
True
|
Returns:
| Type | Description |
|---|---|
list[BlockId]
|
The IDs of the added blocks (format |
Raises:
| Type | Description |
|---|---|
CombinationGenerationError
|
If combinations could not be generated for one or more blocks. The blocks
were added anyway: retry only |
See Also
add_block : Add a single Block to a task. remove_block : Remove a block from a task.
Source code in src/albert/collections/tasks.py
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | |
update_block_workflow
update_block_workflow(
*,
task_id: TaskId,
block_id: BlockId,
workflow_id: WorkflowId,
wait: bool = True,
) -> None
Swap the Workflow assigned to a Block within a task.
Use this to change the conditions a block runs under without removing and re-adding the block. The task must be a Property or Batch task.
When increased intervals is enabled for your tenant, the block's interval
combinations are regenerated for the new workflow before the method returns.
Each combination of the new workflow keeps the interval barcode and results of its
best-matching combination in the replaced workflow. Old combinations that are not
carried forward are removed. Pass wait=False to return as soon as regeneration
has started.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The task containing the block (format |
required |
block_id
|
BlockId
|
The block to update (format |
required |
workflow_id
|
WorkflowId
|
The new Workflow to assign to the block (format |
required |
wait
|
bool
|
Whether to wait until the block's interval combinations are regenerated, when increased intervals is enabled for your tenant. If False, returns as soon as regeneration has started. |
True
|
Returns:
| Type | Description |
|---|---|
None
|
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If the task is not a PropertyTask or BatchTask. |
CombinationGenerationError
|
If the block's combinations could not be regenerated. The workflow was changed
anyway: retry with
|
Notes
If the block already uses workflow_id, no change is made. The block's
final workflow is the one replaced, even when the final slot holds the
default placeholder ("No Parameter Group") alongside another workflow.
Source code in src/albert/collections/tasks.py
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 | |
update_task_workflow
update_task_workflow(
*, task_id: TaskId, workflow_id: WorkflowId
) -> BatchTask
Swap the Workflow assigned to a batch task.
A batch task can reference both an initial and a final workflow. This
replaces the final (current) one and leaves the initial untouched. The
task must be a Batch task. To change the workflow of an individual block,
use update_block_workflow
instead.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The batch task to update (format |
required |
workflow_id
|
WorkflowId
|
The new Workflow to assign to the task (format |
required |
Returns:
| Type | Description |
|---|---|
BatchTask
|
The updated task. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the task is not a BatchTask. |
ValueError
|
If the task has no workflow to replace. |
Notes
If the task already uses workflow_id, no change is made. The workflow
replaced is the one marked as the task's final workflow. When no entry
carries a final/initial marker, the platform default placeholder
("No Parameter Group") is skipped in favor of a real workflow, and
otherwise the first workflow is treated as current.
Source code in src/albert/collections/tasks.py
get_block_combinations
get_block_combinations(
*,
task_id: TaskId,
block_id: BlockId,
max_items: int | None = None,
) -> Iterator[IntervalCombinationItem]
Get the child-workflow interval combinations of a task block.
Retrieves the combinations generated for a task block, for example by
create,
add_block,
create_with_combinations,
or generate_block_combinations.
Always use this method rather than reading combinations directly from the task or block record: for blocks with 500 or more combinations, embedded combination lists on the block are truncated or omitted.
Results are returned as a lazily paginated iterator. Do not infer the end of results from page size: a page can under-return while more combinations remain.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The Property or Batch task ID containing the block (format |
required |
block_id
|
BlockId
|
The block ID whose combinations to list (format |
required |
max_items
|
int
|
Maximum number of combinations to return. If None, iterates over all combinations. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[IntervalCombinationItem]
|
A lazily paginated iterator of combinations. After iteration,
|
Source code in src/albert/collections/tasks.py
get_block_rules
get_block_rules(
*, task_id: TaskId, block_id: BlockId
) -> BlockRules
Get combination rules and overrides for a task block.
Returns the rules (ExclusionRule)
and overrides (CombinationOverride)
currently configured on the specified block.
Rules evaluate criteria against parameter setpoints (using AND logic within a
rule and OR logic across rules) to prune combinations in Exclude Mode or include
combinations in Include Mode. Overrides target specific parameter combinations (with
skip or unskip actions) and always take precedence over rules.
Use this method to inspect existing rules before updating them with
set_block_rules
(which automatically regenerates child-workflow combinations by default).
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The Property or Batch task ID containing the block (format |
required |
block_id
|
BlockId
|
The block ID whose rules to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
BlockRules
|
The rules and overrides configured on the block. |
Source code in src/albert/collections/tasks.py
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | |
add_block_inventory_exclusions
add_block_inventory_exclusions(
*,
task_id: TaskId,
block_id: BlockId,
exclusions: list[InventoryExclusion],
) -> BlockRules
Add inventory x combination exclusions ("masks") to a task block.
Each exclusion marks one task-level inventory tuple
(inv_lot_unique_id, occurrence included) as excluded from one interval
combination (interval_row_key). Excluded pairs are omitted from
property-data grids, exports, and data-completeness checks for the block.
Exclusions are validated on save: both the inventory tuple and the
combination row key must exist on the task/block, and masking the same pair
twice is rejected. Additions are idempotent-safe via
get_block_rules:
check inventory_exclusions first if re-running a script.
Masking an inventory x combination pair
from albert import Albert
from albert.resources.interval_combinations import InventoryExclusion
client = Albert()
# 1. Create the task (a Property task with intervalized workflow blocks)
task = client.tasks.create_with_combinations(task=my_property_task)
# 2. Pick the inventory row to mask. Each task inventory row carries
# its identity as inv_lot_unique_id (e.g. "INV123#LOT456#1").
for inv in task.inventory_information:
print(inv.inventory_id, inv.lot_id, inv.inv_lot_unique_id)
inv_lot_unique_id = task.inventory_information[0].inv_lot_unique_id
# 3. Pick the combination to mask it from. Each combination carries
# its stable identity as interval_row_key (e.g. "ROW3XROW7").
for combo in client.tasks.get_block_combinations(
task_id=task.id, block_id="BLK1"
):
print(combo.name, combo.interval_row_key)
interval_row_key = "ROW3XROW7"
# 4. Mask the pair. That inventory row no longer appears against
# this combination on the block's grid.
client.tasks.add_block_inventory_exclusions(
task_id=task.id,
block_id="BLK1",
exclusions=[
InventoryExclusion(
inv_lot_unique_id=inv_lot_unique_id,
interval_row_key=interval_row_key,
)
],
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The Property or Batch task ID containing the block (format |
required |
block_id
|
BlockId
|
The block ID whose exclusions to add (format |
required |
exclusions
|
list[InventoryExclusion]
|
Exclusions to add. An empty list is a no-op. |
required |
Returns:
| Type | Description |
|---|---|
BlockRules
|
The block's rules, overrides, and inventory exclusions after the change. |
Source code in src/albert/collections/tasks.py
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | |
remove_block_inventory_exclusions
remove_block_inventory_exclusions(
*,
task_id: TaskId,
block_id: BlockId,
exclusion_ids: list[str],
) -> BlockRules
Remove inventory x combination exclusions ("masks") from a task block.
Unmasks previously excluded inventory x combination pairs; the pairs render again on property-data grids.
Unmasking pairs
from albert import Albert
client = Albert()
# Read the block's current masks; each has a server-assigned id.
rules = client.tasks.get_block_rules(task_id="TASFOR1", block_id="BLK1")
# Unmask everything on the block (or pick specific ones by id).
client.tasks.remove_block_inventory_exclusions(
task_id="TASFOR1",
block_id="BLK1",
exclusion_ids=[e.id for e in rules.inventory_exclusions],
)
Changing a mask
A mask has no editable fields (it is the pair), so changing one means removing it and adding the new pair:
from albert import Albert
from albert.resources.interval_combinations import InventoryExclusion
client = Albert()
rules = client.tasks.get_block_rules(task_id="TASFOR1", block_id="BLK1")
# The mask pointing at the wrong combination:
old = next(
e for e in rules.inventory_exclusions
if e.inv_lot_unique_id == "INV123#LOT456#1"
)
client.tasks.remove_block_inventory_exclusions(
task_id="TASFOR1", block_id="BLK1", exclusion_ids=[old.id]
)
client.tasks.add_block_inventory_exclusions(
task_id="TASFOR1",
block_id="BLK1",
exclusions=[
InventoryExclusion(
inv_lot_unique_id=old.inv_lot_unique_id,
interval_row_key="ROW3XROW8", # the right combination
)
],
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The Property or Batch task ID containing the block (format |
required |
block_id
|
BlockId
|
The block ID whose exclusions to remove (format |
required |
exclusion_ids
|
list[str]
|
Server-assigned exclusion IDs (UUIDs), from
|
required |
Returns:
| Type | Description |
|---|---|
BlockRules
|
The block's rules, overrides, and inventory exclusions after the change. |
Source code in src/albert/collections/tasks.py
1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
set_block_rules
set_block_rules(
*,
task_id: TaskId,
block_id: BlockId,
rules: list[ExclusionRule] | None = None,
overrides: list[CombinationOverride] | None = None,
generate_combinations: bool = True,
old_workflow_id: WorkflowId | None = None,
wait: bool = True,
) -> BlockRules
Set combination rules and overrides for a task block.
Configures or replaces rules and overrides on the specified block, and by default immediately recomputes and regenerates child-workflow combinations on Albert.
Rules, Overrides, and Baseline Modes:
- Rules (Criteria-Based Filtering): A rule consists of one or more conditions comparing parameter values against thresholds. All conditions within a rule must match (AND logic). If any rule matches (OR logic across rules):
- In Exclude Mode (
intervals_start_from="all", default), the combination is excluded. - In Include Mode (
intervals_start_from="none"), the combination is included. - Overrides (Targeted Setpoint Overrides): Overrides target a specific combination variant by its exact parameter values:
action=OverrideAction.SKIP: explicitly excludes the combination.action=OverrideAction.UNSKIP: explicitly keeps or forces inclusion of the combination.- In Include Mode (
"none"), setis_manual=Trueto designate a manually cherry-picked combination. - Overrides are evaluated first and always take precedence over rules.
Follows the unset-is-not-empty convention:
- Omitting
rules(or leaving it asNone) leaves existing rules untouched. - Passing an empty list (
rules=[]) clears all rules on the block. - The same convention applies to
overrides. - At least one of
rulesoroverridesmust be provided.
When generate_combinations=True (the default), the method persists the rules and
immediately triggers generate_block_combinations,
passing the block's current workflow as old_workflow_id so that unchanged barcodes
are preserved and obsolete combinations are voided. Set generate_combinations=False
to save rule definitions only without triggering combination regeneration.
Rules and overrides can be constructed easily from parameter names and values using
Workflow.build_rule and
Workflow.build_override
on the block's parent workflow. Override keys can also be computed directly using
Workflow.get_override_key.
Example
from albert import Albert
from albert.resources.interval_combinations import (
CombinationOverride,
ExclusionRule,
OverrideAction,
RuleCondition,
RuleOperator,
)
client = Albert()
block_rules = client.tasks.set_block_rules(
task_id="TASFOR1",
block_id="BLK1",
rules=[
ExclusionRule(
name="Exclude high temp and high speed",
conditions=[
RuleCondition(
parameter_group_id="PRG247776",
parameter_id="PRM100",
row_id="ROW2",
operator=RuleOperator.GTE,
value="90",
unit_id="UNI1",
),
RuleCondition(
parameter_group_id="PRG247776",
parameter_id="PRM200",
row_id="ROW5",
operator=RuleOperator.GTE,
value="1500",
unit_id="UNI2",
),
],
)
],
overrides=[
CombinationOverride(
key="PRG247776#PRM100#ROW4-PRG247776#PRM200#ROW9",
action=OverrideAction.SKIP,
),
],
)
# Combinations are regenerated automatically:
print(block_rules.job.state)
# 'successful'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The Property or Batch task ID containing the block (format |
required |
block_id
|
BlockId
|
The block ID whose rules to set (format |
required |
rules
|
list[ExclusionRule]
|
Replacement rules for the block. If omitted ( |
None
|
overrides
|
list[CombinationOverride]
|
Replacement overrides for the block. If omitted ( |
None
|
generate_combinations
|
bool
|
Whether to automatically regenerate child-workflow combinations after saving rules. Defaults to True. |
True
|
old_workflow_id
|
WorkflowId
|
An earlier workflow of the block whose combinations to carry over
(format |
None
|
wait
|
bool
|
Whether to wait for the background generation worker job to finish when
|
True
|
Returns:
| Type | Description |
|---|---|
BlockRules
|
The updated rules and overrides for the block. If |
Raises:
| Type | Description |
|---|---|
ValueError
|
If both |
TypeError
|
If the task is not a PropertyTask or BatchTask. |
AlbertException
|
If combination generation fails or exceeds platform caps. |
Source code in src/albert/collections/tasks.py
1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 | |
generate_block_combinations
generate_block_combinations(
*,
task_id: TaskId,
block_id: BlockId,
old_workflow_id: WorkflowId | None = None,
wait: bool = True,
) -> WorkerJob
Generate child-workflow interval combinations for a task block.
Calculates combination variants from the block's workflow, rules, and overrides, then launches a background generation job to materialize the child workflows on the platform.
Combination Generation Lifecycle:
- Cartesian Product: Evaluates combinations across all intervalized workflow parameters
starting from the block's baseline mode (
intervals_start_from="all"for Exclude Mode, starting with all combinations; or"none"for Include Mode, starting with an empty set). - Rules and Overrides: Applies rules (AND logic within a rule, OR logic across rules) and overrides (which take precedence over rules) to determine active combinations.
- Child Workflows and Barcodes: Each active combination materializes as an independent child workflow record linked to the task block. Every combination receives a unique, persistent interval barcode that remains stable across rule updates as long as the parameter setpoints are unchanged.
Combinations are generated automatically when a block is added
(create,
add_block) or its workflow
changes (update_block_workflow).
Call this method to retry after a
CombinationGenerationError, or
to regenerate after saving rules with generate_combinations=False.
Leave old_workflow_id unset: Albert keeps interval barcodes and results from
the block's earlier combinations, including after a workflow change made in an
earlier call. Pass it only to name a specific earlier workflow of the block.
Once generation finishes, retrieve the resulting combinations using
get_block_combinations.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The Property or Batch task ID containing the block (format |
required |
block_id
|
BlockId
|
The block ID whose combinations to generate (format |
required |
old_workflow_id
|
WorkflowId
|
An earlier workflow of the block whose combinations to carry over
(format |
None
|
wait
|
bool
|
Whether to wait until background generation reaches a terminal state. If False, returns immediately after the generation job is submitted. |
True
|
Returns:
| Type | Description |
|---|---|
WorkerJob
|
The background worker job representing child workflow generation, with
fields like |
Notes
When triggering combination generation across multiple blocks sequentially on the same task, pace consecutive calls by at least 10 seconds between blocks.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the block is not found or has no assigned workflow. |
TypeError
|
If the task is not a PropertyTask or BatchTask. |
AlbertException
|
If the generated combinations exceed the platform cap of 2,000, or if
|
Source code in src/albert/collections/tasks.py
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 | |
remove_block
Remove a Block from a Property or Batch task.
Removing a block also removes the results captured against it. To keep the
block but change its conditions, use update_block_workflow instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The task to remove the block from (e.g. |
required |
block_id
|
BlockId
|
The block to remove (e.g. |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/tasks.py
import_results
import_results(
*,
task_id: TaskId,
data_template_id: DataTemplateId,
inventory_id: InventoryId | None = None,
block_id: BlockId | None = None,
attachment_id: AttachmentId | None = None,
file_path: str | Path | None = None,
note_text: str | None = None,
lot_id: LotId | None = None,
interval: str = "default",
field_mapping: dict[str, str] | None = None,
mode: ImportMode = CSV,
schema_version: Literal[1, 2] | None = None,
) -> BaseTask
Import results from an attachment into property data. Reuse an existing attachment or upload a new one, optionally provide header-to-column mappings, and target the desired block, lot, and interval. Returns the task after the import.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The property task receiving the results. |
required |
data_template_id
|
DataTemplateId
|
Data template Id. |
required |
inventory_id
|
InventoryId | None
|
Inventory item id. Required when |
None
|
block_id
|
BlockId | None
|
Target block on the task where the data will be written. Optional when a single block is present on the task. If multiple blocks exist, this parameter must be provided. |
None
|
attachment_id
|
AttachmentId | None
|
Existing attachment to use. Exactly one of |
None
|
file_path
|
str | Path | None
|
Local file to upload and attach to a new note on the task. Exactly one of
|
None
|
note_text
|
str | None
|
Optional text for the note created when uploading a new file. |
None
|
lot_id
|
LotId | None
|
Lot context when deleting/writing property data. |
None
|
interval
|
str
|
Interval combination to write to, as an interval ID ( |
'default'
|
field_mapping
|
dict[str, str] | None
|
Optional mapping from CSV header labels to data column names. Keys should match the
header text from the CSV (case-insensitive comparison is applied), and values should
match the corresponding data template column names. For example,
|
None
|
mode
|
ImportMode
|
Import mode to use, by default ImportMode.CSV. Use ImportMode.SCRIPT to run a custom script to process the CSV before import. This requires a script attachment on the data template. |
CSV
|
schema_version
|
(1, 2)
|
The TaskMetadata schema version to send to the script execution runner. When None (the default), automatically detected from the block's Increased Intervals configuration (version 2 if increased intervals are configured on the block, otherwise version 1). Explicitly pass 1 for legacy ROW payloads or 2 for Increased Intervals compact payloads. |
1
|
Returns:
| Type | Description |
|---|---|
BaseTask
|
The task with the newly imported results. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the task is a batch task, which this method does not support. |
Source code in src/albert/collections/tasks.py
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 | |
delete
Delete a task by its ID.
Deleting a task also removes any results recorded against its blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
TaskId
|
The task to delete (format |
required |
delay
|
int
|
Time in milliseconds the platform waits before running post-delete synchronization of dependent records. Omit for no delay. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in src/albert/collections/tasks.py
get_by_id
Get a single, fully populated task by its ID.
The returned object is the concrete type matching the task's category:
PropertyTask, BatchTask, GeneralTask, or ReactionBatchTask.
For a PropertyTask this includes its blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
TaskId
|
The task to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
BaseTask
|
The fully populated task. |
Source code in src/albert/collections/tasks.py
search
search(
*,
text: str | None = None,
tags: list[str] | None = None,
task_id: list[TaskId] | None = None,
linked_task: list[TaskId] | None = None,
category: TaskCategory | str | list[str] | None = None,
albert_id: list[str] | None = None,
data_template: list[str] | None = None,
assigned_to: list[str] | None = None,
assigned_to_id: 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: ProjectId | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
updated_by: str | list[str] | None = None,
from_updated_at: str | None = None,
to_updated_at: str | None = None,
additional_field: str | list[str] | None = None,
collaborator_pop_up: bool | None = None,
contains_field: list[str] | None = None,
contains_text: list[str] | None = None,
due_date_duration: str | None = None,
facet_field: str | None = None,
facet_text: str | None = None,
has_attachment: str | list[str] | None = None,
has_notes: str | list[str] | None = None,
linked_to: list[str] | None = None,
source_field: str | list[str] | None = None,
witness_status: list[str] | None = None,
metadata_filters: dict[str, Any] | None = None,
order_by: OrderBy = DESCENDING,
sort_by: str | None = None,
max_items: int | None = None,
offset: int = 0,
) -> Iterator[TaskSearchItem]
Search for tasks matching the given filters.
Returns lightweight, partially populated results and is the fastest way to
look tasks up. When you need complete tasks (e.g. a PropertyTask's blocks),
use get_all with the same filters, or pass the resulting IDs to
get_by_id. Results are returned as a lazily paginated iterator.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text search across multiple task fields. |
None
|
tags
|
list[str]
|
Filter by tags associated with tasks. |
None
|
task_id
|
list[str]
|
Filter by task IDs (e.g., |
None
|
linked_task
|
list[str]
|
Task IDs linked to the ones being searched. |
None
|
category
|
TaskCategory
|
Filter by task category: |
None
|
albert_id
|
list[str]
|
Filter by Albert IDs of entities linked to the tasks (e.g. inventory
IDs like |
None
|
data_template
|
list[str]
|
Data template names associated with tasks. |
None
|
assigned_to
|
list[str]
|
User names assigned to the tasks. |
None
|
location
|
list[str]
|
Locations where tasks are carried out. |
None
|
priority
|
list[str]
|
Priority levels for filtering tasks. |
None
|
status
|
list[str]
|
Task status values (e.g., Open, Done). |
None
|
parameter_group
|
list[str]
|
Parameter Group names associated with tasks. |
None
|
created_by
|
list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
project_id
|
ProjectId
|
ID of the parent project for filtering tasks. |
None
|
from_created_at
|
str
|
Only include items created on or after this date (ISO 8601). |
None
|
to_created_at
|
str
|
Only include items created on or before this date (ISO 8601). |
None
|
updated_by
|
str or list[str]
|
Filter by user(s) who last updated the tasks. Accepts UserId(s) only
(e.g. |
None
|
from_updated_at
|
str
|
Only include items updated on or after this date (ISO 8601). |
None
|
to_updated_at
|
str
|
Only include items updated on or before this date (ISO 8601). |
None
|
assigned_to_id
|
list[str]
|
Filter by assigned user ID(s) (e.g. |
None
|
additional_field
|
str or list[str]
|
Request additional columns from the search index. |
None
|
collaborator_pop_up
|
bool
|
When True, restrict results for the collaborator pop-up UI. |
None
|
contains_field
|
list[str]
|
Fields to search inside. |
None
|
contains_text
|
list[str]
|
Values to search for within |
None
|
due_date_duration
|
str
|
Filter by due date duration bucket. |
None
|
facet_field
|
str
|
Facet field to filter on. |
None
|
facet_text
|
str
|
Facet text to search for. |
None
|
has_attachment
|
str or list[str]
|
Filter tasks by attachment presence. |
None
|
has_notes
|
str or list[str]
|
Filter tasks by note presence. |
None
|
linked_to
|
list[str]
|
Filter by linked entity ID(s). |
None
|
source_field
|
str or list[str]
|
Restrict which fields are returned in the response. |
None
|
witness_status
|
list[str]
|
Filter by witness status (e.g. |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values. Keys are custom field names.
For string-type custom fields, map the name to a list of values, e.g.
|
None
|
order_by
|
OrderBy
|
The order in which to return results (asc or desc), default DESCENDING. |
DESCENDING
|
sort_by
|
str
|
Attribute to sort tasks by (e.g., createdAt, name). |
None
|
max_items
|
int
|
Maximum number of tasks to return in total. If None, iterates over all matches. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[TaskSearchItem]
|
A lazily paginated iterator of partially populated search results. |
Source code in src/albert/collections/tasks.py
2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 | |
get_all
get_all(
*,
text: str | None = None,
tags: list[str] | None = None,
task_id: list[TaskId] | None = None,
linked_task: list[TaskId] | None = None,
category: TaskCategory | str | list[str] | None = None,
albert_id: list[str] | None = None,
data_template: list[str] | None = None,
assigned_to: list[str] | None = None,
assigned_to_id: 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: ProjectId | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
updated_by: str | list[str] | None = None,
from_updated_at: str | None = None,
to_updated_at: str | None = None,
additional_field: str | list[str] | None = None,
collaborator_pop_up: bool | None = None,
contains_field: list[str] | None = None,
contains_text: list[str] | None = None,
due_date_duration: str | None = None,
facet_field: str | None = None,
facet_text: str | None = None,
has_attachment: str | list[str] | None = None,
has_notes: str | list[str] | None = None,
linked_to: list[str] | None = None,
source_field: str | list[str] | None = None,
witness_status: list[str] | None = None,
metadata_filters: dict[str, Any] | None = None,
order_by: OrderBy = DESCENDING,
sort_by: str | None = None,
max_items: int | None = None,
offset: int = 0,
) -> Iterator[BaseTask]
Get fully populated tasks matching the given filters.
Accepts the same filters as search but returns complete task
entities (PropertyTask, BatchTask, GeneralTask, or ReactionBatchTask) rather than
lightweight search results. This is slower because it fetches full detail
for every match, so prefer search when you only need names, IDs, or
status. Results are returned as a lazily paginated iterator.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Text search across multiple task fields. |
None
|
tags
|
list[str]
|
Filter by tags associated with tasks. |
None
|
task_id
|
list[str]
|
Filter by task IDs (e.g. |
None
|
linked_task
|
list[str]
|
Task IDs linked to the ones being searched. |
None
|
category
|
TaskCategory
|
Filter by task category: |
None
|
albert_id
|
list[str]
|
Filter by Albert IDs of entities linked to the tasks (e.g. inventory
IDs like |
None
|
data_template
|
list[str]
|
Data template names associated with tasks. |
None
|
assigned_to
|
list[str]
|
User names assigned to the tasks. |
None
|
location
|
list[str]
|
Locations where tasks are carried out. |
None
|
priority
|
list[str]
|
Priority levels for filtering tasks. |
None
|
status
|
list[str]
|
Task status values (e.g. |
None
|
parameter_group
|
list[str]
|
Parameter Group names associated with tasks. |
None
|
created_by
|
list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
project_id
|
ProjectId
|
ID of the parent project for filtering tasks. |
None
|
from_created_at
|
str
|
Only include items created on or after this date (ISO 8601). |
None
|
to_created_at
|
str
|
Only include items created on or before this date (ISO 8601). |
None
|
updated_by
|
str or list[str]
|
Filter by user(s) who last updated the tasks. Accepts UserId(s) only
(e.g. |
None
|
from_updated_at
|
str
|
Only include items updated on or after this date (ISO 8601). |
None
|
to_updated_at
|
str
|
Only include items updated on or before this date (ISO 8601). |
None
|
assigned_to_id
|
list[str]
|
Filter by assigned user ID(s) (e.g. |
None
|
additional_field
|
str or list[str]
|
Request additional columns from the search index. |
None
|
collaborator_pop_up
|
bool
|
When True, restrict results for the collaborator pop-up UI. |
None
|
contains_field
|
list[str]
|
Fields to search inside. |
None
|
contains_text
|
list[str]
|
Values to search for within |
None
|
due_date_duration
|
str
|
Filter by due date duration bucket. |
None
|
facet_field
|
str
|
Facet field to filter on. |
None
|
facet_text
|
str
|
Facet text to search for. |
None
|
has_attachment
|
str or list[str]
|
Filter tasks by attachment presence. |
None
|
has_notes
|
str or list[str]
|
Filter tasks by note presence. |
None
|
linked_to
|
list[str]
|
Filter by linked entity ID(s). |
None
|
source_field
|
str or list[str]
|
Restrict which fields are returned in the response. |
None
|
witness_status
|
list[str]
|
Filter by witness status (e.g. |
None
|
metadata_filters
|
dict[str, Any]
|
Filter by custom field (metadata) values. Keys are custom field names.
For string-type custom fields, map the name to a list of values, e.g.
|
None
|
order_by
|
OrderBy
|
Sort direction. Default |
DESCENDING
|
sort_by
|
str
|
Attribute to sort tasks by (e.g. |
None
|
max_items
|
int
|
Maximum number of tasks to return in total. If None, iterates over all matches. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[BaseTask]
|
Fully populated tasks. Preserves |
Source code in src/albert/collections/tasks.py
2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 | |
update
Update an existing task.
Fetch the task (e.g. with get_by_id), modify the updatable fields,
then pass it here. Only the fields listed in Notes are applied. To change a
task's blocks, use add_block, remove_block, or
update_block_workflow instead.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task
|
BaseTask
|
The task to update. Must have a valid |
required |
Returns:
| Type | Description |
|---|---|
BaseTask
|
The updated task. |
Notes
The following fields can be updated: assigned_to, due_date,
inventory_information, metadata, name, priority, project,
state, tags.
state and assigned_to are coupled: a task cannot be In Progress
(or any state beyond Not Started) while unassigned, so moving an
unclaimed task forward also assigns it to the calling user.
Any tags that do not yet exist in Albert are created automatically.
Source code in src/albert/collections/tasks.py
allocate_inventory
allocate_inventory(
*,
task_id: TaskId,
allocations: list[
TaskLotAllocation | TaskParameterAllocation
],
block_id: BlockId | None = None,
) -> BaseTask
Record how much inventory a task consumed (allocate inventory / assign lots).
Two kinds of allocation are supported and can be mixed in one call:
TaskLotAllocation: the task's own inventory. Sets the absolute quantity used for one inventory item + lot pair.TaskParameterAllocation: an inventory-linked special parameter (Equipment, Consumables, Templates) on a block's workflow. The target row is found automatically from the workflow; set the allocation'sparameterwhen the same item sits on more than one parameter row, orrow_idto target a row directly.
Allocations against the task's own inventory set the absolute quantity used; allocations against special parameter rows add lot quantities to the row.
Example
from albert.resources.tasks import (
AllocatedLot,
TaskLotAllocation,
TaskParameterAllocation,
)
# The task's own inventory
client.tasks.allocate_inventory(
task_id="TASFOR1",
allocations=[
TaskLotAllocation(
inventory_id="INVB9999999", lot_id="LOT9999999", quantity=0.5
)
],
)
# A special parameter row on a block (e.g. the "Light Source" equipment)
client.tasks.allocate_inventory(
task_id="TASFOR2",
block_id="BLK2",
allocations=[
TaskParameterAllocation(
inventory_id="INVC9999999",
lots=[AllocatedLot(lot_id="LOT8888888", quantity=1.5)],
)
],
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_id
|
TaskId
|
The task to allocate inventory on (format |
required |
allocations
|
list of TaskLotAllocation or TaskParameterAllocation
|
The allocations to record. An empty list leaves the task unchanged. |
required |
block_id
|
BlockId
|
The block whose workflow carries the special parameters (format
|
None
|
Returns:
| Type | Description |
|---|---|
BaseTask
|
The task after the allocation. |
Raises:
| Type | Description |
|---|---|
AlbertException
|
If |
Source code in src/albert/collections/tasks.py
2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 | |
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
Get the audit history for a task.
Returns the chronological record of changes made to the task (and, optionally, a specific block).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
TaskId
|
The task to inspect (format |
required |
order
|
OrderBy
|
Sort direction for history entries. Default |
DESCENDING
|
limit
|
int
|
Maximum number of history entries to return. |
1000
|
entity
|
HistoryEntity
|
Restrict history to a specific entity scope (e.g. |
None
|
blockId
|
str
|
Restrict history to a specific block. |
None
|
startKey
|
str
|
Pagination key used to continue a previous history query. |
None
|
Returns:
| Type | Description |
|---|---|
TaskHistory
|
The task's history entries plus pagination metadata. |