Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold S3 remote persistence interface #3

Merged
merged 3 commits into from Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
696 changes: 686 additions & 10 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Expand Up @@ -87,6 +87,10 @@ nix = "0.26.2"

regex = "1.7.3"

# Enabled with the "s3" feature.
aws-config = "0.55.0"
aws-sdk-s3 = "0.25.0"

[workspace.dependencies.uuid]
version = "1.3.0"
features = [
Expand Down
2 changes: 1 addition & 1 deletion bigtest/benchmark_harness.js
Expand Up @@ -44,7 +44,7 @@ const VERSION_FILE = `${STATEDIR}/version`;

const BATCH_SIZE = 14;
const EXPECTED_NUM_TESTS = 500;
const MAX_WORKER_OVERHEAD_PCT = 10; // 10%
const MAX_WORKER_OVERHEAD_PCT = 16; // 16%

function runBenchmark(
{
Expand Down
1 change: 1 addition & 0 deletions crates/abq_cli/Cargo.toml
Expand Up @@ -64,3 +64,4 @@ regex.workspace = true

[features]
test-abq-jest = []
s3 = [ "abq_queue/s3" ]
9 changes: 9 additions & 0 deletions crates/abq_queue/Cargo.toml
Expand Up @@ -25,6 +25,15 @@ async-trait.workspace = true

anyhow.workspace = true

aws-config = { workspace = true, optional = true }
aws-sdk-s3 = { workspace = true, optional = true }

[features]
s3 = [
"dep:aws-config",
"dep:aws-sdk-s3",
]

[dev-dependencies]
abq_utils = { path = "../abq_utils", features = ["expose-native-protocols"] }
abq_test_utils = { path = "../abq_test_support/abq_test_utils" }
Expand Down
2 changes: 2 additions & 0 deletions crates/abq_queue/src/persistence.rs
@@ -1,2 +1,4 @@
pub mod manifest;
pub mod results;

pub mod remote;
40 changes: 40 additions & 0 deletions crates/abq_queue/src/persistence/remote.rs
@@ -0,0 +1,40 @@
//! Utilities for remote persistence of [results] and [manifest]s.
//!
//! [results]: super::results
//! [manifest]: super::manifest

use std::path::Path;

use abq_utils::{error::OpaqueResult, net_protocol::workers::RunId};
use async_trait::async_trait;

#[cfg(feature = "s3")]
mod s3;

#[cfg(feature = "s3")]
pub use s3::{S3Client, S3Persister};

pub enum PersistenceKind {
Manifest,
Results,
}

#[async_trait]
pub trait RemotePersistence {
/// Stores a file from the local filesystem to the remote persistence.
async fn store(
&self,
kind: PersistenceKind,
run_id: RunId,
from_local_path: &Path,
) -> OpaqueResult<()>;

/// Loads a file from the remote persistence to the local filesystem.
/// The given local path must have all intermediate directories already created.
async fn load(
&self,
kind: PersistenceKind,
run_id: RunId,
into_local_path: &Path,
) -> OpaqueResult<()>;
}