capturegraph.procedures.nodes.automatic.structural
#
Structural Procedures#
Structural procedures control the organization and execution order of other procedures. These define how workflows are composed, including sequential execution, parallel execution, dependencies, and optional steps.
Example
from capturegraph.procedures.nodes.action import CaptureImage, UserInputString
from capturegraph.procedures.nodes.automatic import ProcedureSequence, ProcedureSet
from capturegraph.procedures.nodes.filesystem import GetRootDirectory
def daily_capture():
target = GetRootDirectory()
session = target.new_session("daily")
return ProcedureSequence(
label="Daily Capture",
procedures=[
session.new_file("photo").save(CaptureImage(label="Photo")),
session.new_file("notes").save(UserInputString(label="Notes")),
]
)
ProcedureSequence
#
Executes a list of procedures in sequential order.
Each procedure in the list is executed one after another, waiting for
completion before moving to the next. All procedures must return PVoid.
Attributes:
| Name | Type | Description |
|---|---|---|
procedures |
list[Procedure[PVoid]]
|
List of procedures to execute in order. |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/automatic/structural.py
ProcedureSet
#
Executes a list of procedures concurrently (in parallel).
All procedures in the set are started at the same time and can complete
in any order. All procedures must return PVoid.
Attributes:
| Name | Type | Description |
|---|---|---|
procedures |
list[Procedure[PVoid]]
|
List of procedures to execute concurrently. |
Example
Source code in capturegraph-lib/capturegraph/procedures/nodes/automatic/structural.py
RequireProcedureCompleted
#
Ensures that a specific procedure has been completed successfully.
Acts as a checkpoint to verify that a required procedure has finished executing before allowing the workflow to continue. Useful for enforcing dependencies between procedures.
Attributes:
| Name | Type | Description |
|---|---|---|
procedure |
Procedure[PType]
|
The procedure that must be completed. |
Source code in capturegraph-lib/capturegraph/procedures/nodes/automatic/structural.py
OptionalProcedure
#
Marks a procedure as optional, allowing it to be skipped or fail gracefully.
The wrapped procedure can fail without causing the overall workflow to fail. Useful for non-critical actions like thumbnail generation.
Attributes:
| Name | Type | Description |
|---|---|---|
procedure |
Procedure[PVoid]
|
The procedure to make optional. |