Skip to content

Loop Blocks

Accessed via client.loop_blocks.

pyawe.client.LoopBlocksClient

LoopBlocksClient(http: _HttpSession)

Methods for the /loop-blocks resource.

create

create(name: str, workflow_id: Union[UUID, str], loop_type: str, loop_config: Any) -> CreateLoopBlockResponse

Create a loop block task inside a workflow.

Creates both the outer task (of type "loop_block") and an empty inner workflow that will be executed on each iteration.

Parameters:

Name Type Description Default
name str

Name shown on the loop block node and used as the inner workflow name.

required
workflow_id Union[UUID, str]

UUID of the outer workflow.

required
loop_type str

"count", "while", or "for_each".

required
loop_config Any

Type-dependent configuration dict:

  • "count": {"count": N}
  • "while": {"condition": "continue"}
  • "for_each": {"collection": [...]}
required

Returns:

Type Description
CreateLoopBlockResponse

class:~pyawe.models.CreateLoopBlockResponse containing the new

CreateLoopBlockResponse

outer task and loop block record.

Raises:

Type Description
AweAuthError

If not authenticated.

AweValidationError

On a 400 response.

get

get(loop_block_id: Union[UUID, str]) -> LoopBlock

Fetch a loop block.

Parameters:

Name Type Description Default
loop_block_id Union[UUID, str]

UUID of the loop block.

required

Returns:

Type Description
LoopBlock

class:~pyawe.models.LoopBlock.

Raises:

Type Description
AweNotFoundError

If the loop block does not exist.

AweAuthError

If not authenticated.

update

update(loop_block_id: Union[UUID, str], *, name: Optional[str] = None, loop_type: Optional[str] = None, loop_config: Optional[Any] = None) -> LoopBlock

Update a loop block; only supplied fields are changed.

Renaming the loop block also renames the inner workflow.

Parameters:

Name Type Description Default
loop_block_id Union[UUID, str]

UUID of the loop block.

required
name Optional[str]

New name.

None
loop_type Optional[str]

New loop type.

None
loop_config Optional[Any]

New loop configuration.

None

Returns:

Type Description
LoopBlock

The updated :class:~pyawe.models.LoopBlock.

Raises:

Type Description
AweNotFoundError

If the loop block does not exist.

AweAuthError

If not authenticated.

delete

delete(loop_block_id: Union[UUID, str]) -> None

Delete a loop block.

Parameters:

Name Type Description Default
loop_block_id Union[UUID, str]

UUID of the loop block.

required

Raises:

Type Description
AweNotFoundError

If the loop block does not exist.

AweAuthError

If not authenticated.