Skip to content

decorators.step_decorator

step_decorator

Classes:

Name Description
Step

Functions:

Name Description
step

Decorator to create a step.

Attributes:

Name Type Description
F

F = TypeVar('F', bound=Callable[..., Any]) module-attribute

Step(continue_on_failure, entrypoint, metadata)

Parameters:

Name Type Description Default

continue_on_failure

bool

Tells if the step should be executed, even if the previous steps have failed.

required

entrypoint

F

The function to be executed when the step is called.

required

metadata

StepMetadata

The metadata associated to the step.

required

Methods:

Name Description
log_step_info

Wrapper to log step information.

Attributes:

Name Type Description
id
step_name
continue_on_failure
entrypoint
metadata StepMetadata

The metadata associated to the step.

state StepState

The step's current state.

id = metadata.id instance-attribute

step_name = metadata.name instance-attribute

continue_on_failure = continue_on_failure instance-attribute

entrypoint = entrypoint instance-attribute

metadata property

The metadata associated to the step.

Returns:

Type Description
StepMetadata

The metadata associated to the step.

state property

The step's current state.

Returns:

Type Description
StepState

The step's current state.

log_step_info(pipeline, step_logger, log_content)

Wrapper to log step information.

Parameters:

Name Type Description Default
pipeline
Pipeline

The pipeline the step belongs to.

required
step_logger
Logger

The logger to use for logging.

required
log_content
str

The content to log.

required

step(_func=None, name=None, continue_on_failure=False)

step(_func: F) -> Step
step(*, name: str | None = None, continue_on_failure: bool = False) -> Callable[[F], Step]

Decorator to create a step. The step will automatically be registered in the current pipeline and log its content inside a dedicated log file.

Parameters:

Name Type Description Default

_func

Optional[F]

The decorated function.

None

name

str | None

The name of the step. If left empty, the name of the decorated function will be used as a fallback.

None

continue_on_failure

bool

Tells if the step should be executed, even if the previous steps have failed

False

Returns:

Type Description
Union[Step, Callable[[F], Step]]

A pipeline instance.