Workflows
albert.collections.workflows.WorkflowCollection
Bases: BaseCollection
WorkflowCollection is a collection class for managing Workflow entities in the Albert platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The Albert session instance. |
required |
Methods:
| Name | Description |
|---|---|
create |
Create workflows, or return existing ones if a match is found. |
get_by_id |
Retrieve a Workflow by its ID. |
get_by_ids |
Returns a list of Workflow entities by their IDs. |
get_all |
Get all workflows. Unlikely to be used in production. |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
|
Source code in src/albert/collections/workflows.py
create
Create workflows, or return existing ones if a match is found.
Deduplicates by parameter setpoints — if a workflow with identical
setpoints already exists, it is returned instead of creating a new one.
Returned workflows will have an empty parameter_group_setpoints list
regardless of whether they were created or matched; use get_by_id to
fetch the full setpoints if needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflows
|
list[Workflow]
|
A list of Workflow entities to find or create. |
required |
Returns:
| Type | Description |
|---|---|
list[Workflow]
|
A list of created or matched Workflow entities. |
Source code in src/albert/collections/workflows.py
get_by_id
get_by_id(*, id: WorkflowId) -> Workflow
Retrieve a Workflow by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
The ID of the Workflow to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
Workflow
|
The Workflow object. |
Source code in src/albert/collections/workflows.py
get_by_ids
get_by_ids(*, ids: list[WorkflowId]) -> list[Workflow]
Returns a list of Workflow entities by their IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[str]
|
The list of Workflow IDs to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
list[Workflow]
|
The list of Workflow entities matching the provided IDs. |
Source code in src/albert/collections/workflows.py
get_all
Get all workflows. Unlikely to be used in production.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_items
|
int
|
Maximum number of items to return in total. If None, fetches all available items. |
None
|
Yields:
| Type | Description |
|---|---|
Iterator[Workflow]
|
An iterator of Workflow entities. |