Checkpointing utilities for pipeline state management.
Enables saving and resuming pipeline execution state, which is critical for long-running database builds that may fail partway through.
Checkpoint
¶
Represents a single checkpoint in pipeline execution.
| Attributes: |
|
|---|
__init__(stage_name, timestamp=None, metadata=None)
¶
Create a checkpoint.
| Parameters: |
|
|---|
to_dict()
¶
Convert checkpoint to dictionary.
| Returns: |
|
|---|
from_dict(data)
classmethod
¶
Create checkpoint from dictionary.
| Parameters: |
|
|---|
| Returns: |
|
|---|
CheckpointManager
¶
Manages pipeline checkpoints for fault tolerance.
Handles saving, loading, and querying pipeline execution state to enable resuming from failures.
| Attributes: |
|
|---|
__init__(checkpoint_dir)
¶
Initialize checkpoint manager.
| Parameters: |
|
|---|
save_checkpoint(stage_name, metadata=None)
¶
Save a checkpoint for a completed stage.
| Parameters: |
|
|---|
get_last_checkpoint()
¶
Get the most recent checkpoint.
| Returns: |
|
|---|
get_completed_stages()
¶
Get list of all completed stage names.
| Returns: |
|
|---|
is_stage_completed(stage_name)
¶
Check if a stage has been completed.
| Parameters: |
|
|---|
| Returns: |
|
|---|
get_checkpoint_for_stage(stage_name)
¶
Get the checkpoint for a specific stage.
| Parameters: |
|
|---|
| Returns: |
|
|---|
clear_checkpoints()
¶
Clear all checkpoints and reset state.
clear_from_stage(stage_name)
¶
Clear all checkpoints from a specific stage onwards.
| Parameters: |
|
|---|
export_state(output_path)
¶
Export checkpoint state to a file.
| Parameters: |
|
|---|
import_state(input_path)
¶
Import checkpoint state from a file.
| Parameters: |
|
|---|
get_summary()
¶
Get a human-readable summary of checkpoint state.
| Returns: |
|
|---|
create_stage_checkpoint(checkpoint_dir, stage_name, stats=None)
¶
Convenience function to create a checkpoint for a stage.
| Parameters: |
|
|---|
should_skip_stage(checkpoint_dir, stage_name)
¶
Check if a stage can be skipped based on checkpoint.
| Parameters: |
|
|---|
| Returns: |
|
|---|