S3BenchmarkStorage#
- class openstef_beam.benchmarking.S3BenchmarkStorage(local_storage: LocalBenchmarkStorage, bucket_name: str, s3_prefix: str = '', s3fs_kwargs: dict[str, Any] | None = None)[source]#
Bases:
BenchmarkStorageS3-backed storage implementation that combines local and cloud storage.
Provides a hybrid approach where benchmark artifacts are first stored locally and then automatically synced to S3. All read operations use the local storage, while write operations trigger both local storage and S3 upload.
Requires the s3fs package for S3 operations. Uses the local storage instance for file organization and path management, ensuring consistent structure between local and S3 storage.
- Parameters:
local_storage (
LocalBenchmarkStorage)bucket_name (
str)s3_prefix (
str)s3fs_kwargs (
dict[str,Any] |None)
- __init__(local_storage: LocalBenchmarkStorage, bucket_name: str, s3_prefix: str = '', s3fs_kwargs: dict[str, Any] | None = None)[source]#
Initialize S3 storage with local storage delegation.
- Parameters:
local_storage (
LocalBenchmarkStorage) – The LocalBenchmarkStorage instance for local file operations.bucket_name (
str) – Name of the S3 bucket where files will be stored.s3_prefix (
str) – Optional prefix for all S3 object keys to organize files.s3fs_kwargs (
dict[str,Any] |None) – Additional keyword arguments passed to S3FileSystem constructor for authentication and configuration.local_storage
bucket_name
s3_prefix
s3fs_kwargs
- Raises:
MissingExtraError – When s3fs package is not installed.
- save_backtest_output(target: BenchmarkTarget, output: TimeSeriesDataset) None[source]#
Save backtest predictions locally and sync to S3.
- Parameters:
target (
BenchmarkTarget)output (
TimeSeriesDataset)
- Return type:
None
- load_backtest_output(target: BenchmarkTarget) TimeSeriesDataset[source]#
Load backtest predictions from local storage.
- Returns:
The loaded prediction data.
- Return type:
- Parameters:
target (
BenchmarkTarget)- Return type:
- has_backtest_output(target: BenchmarkTarget) bool[source]#
Check if backtest output exists in local storage.
- Returns:
True if backtest output exists locally.
- Return type:
bool
- Parameters:
target (
BenchmarkTarget)- Return type:
bool
- save_evaluation_output(target: BenchmarkTarget, output: EvaluationReport) None[source]#
Save evaluation report locally and sync to S3.
- Parameters:
target (
BenchmarkTarget)output (
EvaluationReport)
- Return type:
None
- load_evaluation_output(target: BenchmarkTarget) EvaluationReport[source]#
Load evaluation report from local storage.
- Returns:
The loaded evaluation report.
- Return type:
- Parameters:
target (
BenchmarkTarget)- Return type:
- has_evaluation_output(target: BenchmarkTarget) bool[source]#
Check if evaluation output exists in local storage.
- Returns:
True if evaluation output exists locally.
- Return type:
bool
- Parameters:
target (
BenchmarkTarget)- Return type:
bool
- save_analysis_output(output: AnalysisOutput) None[source]#
Save analysis visualizations locally and sync to S3.
- Parameters:
output (
AnalysisOutput)- Return type:
None
- has_analysis_output(scope: AnalysisScope) bool[source]#
Check if analysis output exists in local storage.
- Returns:
True if analysis output exists locally.
- Return type:
bool
- Parameters:
scope (
AnalysisScope)- Return type:
bool