Workflows
albert.collections.workflows.WorkflowCollection
Bases: BaseCollection
Manage Workflows in the Albert platform.
A Workflow is a grouping of parameters and their setpoints, the independent variables a test is run under. It is built from one or more groupings, where each grouping is either a Data Template with pre-linked parameters or a Parameter Group. A single Workflow can combine a Data Template's pre-linked parameters with one or more Parameter Groups, each contributing its own parameter setpoints (a value, plus a unit where applicable). Because a Data Template can carry pre-linked parameters, it is used here exactly like a Parameter Group: purely to describe parameters and their setpoints.
A Workflow does not include a Data Template's Data Columns (also called
Results). Those are the dependent variables, and they are recorded only in
Property Data (PropertyDataCollection). In
short, the Workflow holds the independent variables and Property Data holds the
dependent ones. A Workflow is also not itself a task: it becomes actionable when
paired with a Data Template inside a Block on a Property or Batch Task (see
add_block).
Uniqueness. A Workflow is uniquely identified by its full setpoint
configuration: the value (and unit) of every parameter setpoint, the order of
the parameters within each Data Template / Parameter Group, and the order of
the Data Templates / Parameter Groups within the workflow. Because of this,
workflows are found-or-created rather than blindly created: to obtain a
workflow ID, build the Workflow object you want and let create return
the existing match or make a new one.
Every tenant also includes a built-in workflow WFL1 ("No Parameter Group") with no
parameter groups. Use it for tasks and blocks that do not involve parameter groups; it
does not need to be created via
create.
Intervals. When one or two parameters are "intervalized" (varied across
several values), the workflow acts as a parent that carries the resulting
interval combinations. Each combination has an interval ID of the form
ROW1 (one intervalized parameter) or ROW1XROW2 (the product of two).
That interval ID is how you target a specific condition when reading or writing
Property Data. Use
get_interval_id to build the
correct interval ID from parameter values.
This collection is accessed as client.workflows.
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 workflow requests. |
Methods:
| Name | Description |
|---|---|
create |
Find-or-create workflows, deduplicating by parameter setpoints. |
get_all_facets |
Get facet groups (aggregated filter counts) for a workflow query. |
get_by_id |
Get a single workflow, including its full setpoints and interval combinations. |
get_by_ids |
Get multiple workflows by their IDs in batches. |
get_all |
Iterate over all workflows (rarely needed in production). |
search |
Search for workflows matching the given filters. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/workflows.py
create
Find or create workflows.
This is the intended way to obtain a workflow ID: build the Workflow object you want and let this method return the existing match or create a new one. Workflows are deduplicated by their full setpoint configuration: the value and unit of every setpoint, the order of parameters within each Data Template / Parameter Group, and the order of those groups within the workflow. Any parameter group supplied by its ID only is expanded to its full parameters before matching.
Example
from albert.resources.workflows import (
Workflow,
ParameterGroupSetpoints,
ParameterSetpoint,
)
# A workflow combining a Data Template's pre-linked parameters (keyed by a
# DAT... id, used just like a Parameter Group) with two Parameter Groups.
workflow = Workflow(
parameter_group_setpoints=[
ParameterGroupSetpoints(
id="DAT9999999",
parameter_setpoints=[
ParameterSetpoint(parameter_id="PRM9999999", value="23"),
ParameterSetpoint(parameter_id="PRM2", value="50"),
],
),
ParameterGroupSetpoints(
id="PRG9999999",
parameter_setpoints=[
ParameterSetpoint(parameter_id="PRM3", value="24"),
],
),
ParameterGroupSetpoints(
id="PRG2",
parameter_setpoints=[
ParameterSetpoint(parameter_id="PRM4", value="2000"),
],
),
],
)
created = client.workflows.create(workflows=[workflow])
created[0].id
# 'WFL1'
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflows
|
list[Workflow]
|
The workflows to find or create. Each is built from parameter group
setpoints (see |
required |
Returns:
| Type | Description |
|---|---|
list[Workflow]
|
The created or matched workflows, in the same order as the input. |
Raises:
| Type | Description |
|---|---|
AlbertPartialError
|
If only some of the workflows could be created or matched. The error
carries the succeeded ( |
Notes
When a group is identified by id, the SDK resolves setpoint sequence row
ids from that Data Template or Parameter Group before create. Do not supply
sequence on ParameterSetpoint
objects.
The platform derives each workflow's name from its parameter groups and
setpoints, so a caller-supplied name is not preserved. Returned workflows
carry the parameter group setpoints they were created or matched with. A matched
workflow without parameter groups (such as the built-in WFL1) comes back
without those details, so the SDK fetches it by ID before returning it.
Source code in src/albert/collections/workflows.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
get_by_id
get_by_id(*, id: WorkflowId) -> Workflow
Get a single workflow by its ID, including its full setpoints and interval combinations.
Includes the fully populated parameter_group_setpoints and any interval
combinations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
WorkflowId
|
The workflow ID (format |
required |
Returns:
| Type | Description |
|---|---|
Workflow
|
The fully populated workflow. |
Source code in src/albert/collections/workflows.py
get_by_ids
get_by_ids(*, ids: list[WorkflowId]) -> list[Workflow]
Get multiple workflows by their IDs.
Arbitrarily long ID lists are supported. Each returned workflow includes its full setpoints. Workflows not found are omitted from the result.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[WorkflowId]
|
The workflow IDs to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
list[Workflow]
|
The matching workflows. Order is not guaranteed to match the input. |
Source code in src/albert/collections/workflows.py
get_all
Iterate over all workflows.
Workflows are usually retrieved by their IDs (via get_by_id) or created
as part of building a task, so a full listing is rarely needed in
production. Results are returned as a lazily paginated iterator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_items
|
int
|
Maximum number of workflows to return in total. If None, iterates over all workflows. |
None
|
Yields:
| Type | Description |
|---|---|
Workflow
|
Each workflow, fully populated. |
Source code in src/albert/collections/workflows.py
search
search(
*,
text: str | None = None,
status: Status | list[Status] | None = None,
created_by: str | list[str] | None = None,
ids: WorkflowId | list[WorkflowId] | None = None,
data_templates: str | list[str] | None = None,
data_template_ids: str | list[str] | None = None,
parameter_groups: str | list[str] | None = None,
parameter_group_ids: str | list[str] | None = None,
parameters: str | list[str] | None = None,
unit: str | list[str] | None = None,
parameter_set: list[WorkflowParameterSet] | None = None,
facet_text: str | None = None,
facet_field: str | None = None,
facet_list: list[str] | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
search_field: list[str] | None = None,
source_field: list[str] | None = None,
from_created_at: str | None = None,
to_created_at: str | None = None,
sort_by: str | None = None,
order_by: OrderBy = DESCENDING,
max_items: int | None = None,
) -> Iterator[WorkflowSearchItem]
Search for workflows matching the given filters.
This is the fast path: it returns partial (unhydrated)
WorkflowSearchItem hits and is
best for lookups, counts, and pulling IDs. To retrieve fully populated
workflows, use get_by_id
or call hydrate() on a hit. Results are returned lazily as an iterator
that pages through the API on demand.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query. |
None
|
status
|
Status or list[Status]
|
Filter by workflow status. |
None
|
created_by
|
str or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
ids
|
WorkflowId or list[WorkflowId]
|
Filter by workflow ID(s) (format |
None
|
data_templates
|
str or list[str]
|
Filter by data template name(s). |
None
|
data_template_ids
|
str or list[str]
|
Filter by data template ID(s) (format |
None
|
parameter_groups
|
str or list[str]
|
Filter by parameter group name(s). |
None
|
parameter_group_ids
|
str or list[str]
|
Filter by parameter group ID(s) (format |
None
|
parameters
|
str or list[str]
|
Filter by parameter name(s). Supports inline range syntax such as
|
None
|
unit
|
str or list[str]
|
Filter by unit name(s). |
None
|
parameter_set
|
list[WorkflowParameterSet]
|
Filter by parameter constraints that bind a name, value range, and unit. |
None
|
facet_text
|
str
|
Text to match within a facet search. |
None
|
facet_field
|
str
|
Field to search within for facet filtering. |
None
|
facet_list
|
list[str]
|
Facet(s) to compute over the matching workflows. One or more of
|
None
|
contains_field
|
str or list[str]
|
Field(s) to apply a "contains" search to. |
None
|
contains_text
|
str or list[str]
|
Text value(s) for the "contains" search. |
None
|
search_field
|
list[str]
|
Restrict which fields the text query searches. |
None
|
source_field
|
list[str]
|
Restrict which fields are returned in search results. |
None
|
from_created_at
|
str
|
Only include workflows created on or after this date (ISO 8601). |
None
|
to_created_at
|
str
|
Only include workflows created on or before this date (ISO 8601). |
None
|
sort_by
|
str
|
Attribute to sort results by. |
None
|
order_by
|
OrderBy
|
The order in which to sort results. Default is |
DESCENDING
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matching items. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[WorkflowSearchItem]
|
A lazy iterator of matching partial workflows. Call
|
Source code in src/albert/collections/workflows.py
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 434 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 | |
get_all_facets
get_all_facets(
*,
text: str | None = None,
status: Status | list[Status] | None = None,
created_by: str | list[str] | None = None,
ids: WorkflowId | list[WorkflowId] | None = None,
data_templates: str | list[str] | None = None,
data_template_ids: str | list[str] | None = None,
parameter_groups: str | list[str] | None = None,
parameter_group_ids: str | list[str] | None = None,
parameters: str | list[str] | None = None,
unit: str | list[str] | None = None,
parameter_set: list[WorkflowParameterSet] | None = None,
facet_list: list[str] | None = None,
) -> list[FacetItem]
Get the facets available for a workflow search.
Facets are the grouped, counted filter options for a query, like the refinement sidebar of a search UI (e.g. how many matching workflows fall under each parameter group or unit). Use them to build progressive filtering or to summarize a result set without fetching every item.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query. |
None
|
status
|
Status or list[Status]
|
Filter by workflow status. |
None
|
created_by
|
str or list[str]
|
Filter by creator. Accepts user display name(s) or UserId(s) (e.g.
|
None
|
ids
|
WorkflowId or list[WorkflowId]
|
Filter by workflow ID(s) (format |
None
|
data_templates
|
str or list[str]
|
Filter by data template name(s). |
None
|
data_template_ids
|
str or list[str]
|
Filter by data template ID(s) (format |
None
|
parameter_groups
|
str or list[str]
|
Filter by parameter group name(s). |
None
|
parameter_group_ids
|
str or list[str]
|
Filter by parameter group ID(s) (format |
None
|
parameters
|
str or list[str]
|
Filter by parameter name(s). Supports inline range syntax such as
|
None
|
unit
|
str or list[str]
|
Filter by unit name(s). |
None
|
parameter_set
|
list[WorkflowParameterSet]
|
Filter by parameter constraints that bind a name, value range, and unit. |
None
|
facet_list
|
list[str]
|
Facet(s) to compute. One or more of |
None
|
Returns:
| Type | Description |
|---|---|
list[FacetItem]
|
The facet groups available for the query. |
Source code in src/albert/collections/workflows.py
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 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | |