-
Notifications
You must be signed in to change notification settings - Fork 92
feat(compression-coordinator): Add the Spider compression job-submission API and its task I/O types. #2401
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
Merged
LinZhihao-723
merged 5 commits into
y-scope:main
from
LinZhihao-723:compression-coordinator-scaffolding
Jul 20, 2026
Merged
feat(compression-coordinator): Add the Spider compression job-submission API and its task I/O types. #2401
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pub mod compression; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| //! Protocol types exchanged with the Spider (Huntsman) tasks that run CLP S3 compression jobs. | ||
|
|
||
| use non_empty_string::NonEmptyString; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use crate::clp_config::AwsAuthentication; | ||
|
|
||
| /// `clp-s` tuning and engine options for a compression job. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
| pub struct ClpSCompressionOption { | ||
| pub target_encoded_size: u64, | ||
| pub compression_level: i32, | ||
| pub timestamp_key: Option<String>, | ||
| } | ||
|
|
||
| /// Input source for a compression task. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
| pub struct S3InputSource { | ||
| pub endpoint_url: Option<NonEmptyString>, | ||
| pub region_code: Option<NonEmptyString>, | ||
| pub bucket: NonEmptyString, | ||
| pub aws_authentication: AwsAuthentication, | ||
| pub object_keys: Vec<String>, | ||
| } | ||
|
|
||
| /// Output of a compression task. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
| pub struct CompressionTaskOutput { | ||
| pub dataset: Option<String>, | ||
| pub archives: Vec<ArchiveMetadata>, | ||
| } | ||
|
|
||
| /// Metadata of an archive produced by `clp-s`. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
| pub struct ArchiveMetadata { | ||
| pub id: String, | ||
| pub begin_timestamp: i64, | ||
| pub end_timestamp: i64, | ||
| pub size: i64, | ||
| pub uncompressed_size: i64, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [package] | ||
| name = "compression-coordinator" | ||
| version = "0.13.1-dev" | ||
| edition = "2024" | ||
|
|
||
| [lib] | ||
| name = "compression_coordinator" | ||
| path = "src/lib.rs" | ||
|
|
||
| [dependencies] | ||
| async-trait = "0.1.89" | ||
| clp-rust-utils = { path = "../clp-rust-utils" } | ||
| serde = { version = "1.0.228", features = ["derive"] } | ||
| spider-core = { git = "https://github.com/y-scope/spider.git", branch = "main" } | ||
| thiserror = "2.0.18" |
93 changes: 93 additions & 0 deletions
93
components/compression-coordinator/src/compression_job_submitter/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| //! The compression-job-submission API trait for driving CLP S3 compression jobs on a Spider | ||
| //! (Huntsman) cluster. | ||
|
|
||
| mod spider; | ||
|
|
||
| use std::time::Duration; | ||
|
|
||
| use async_trait::async_trait; | ||
| use clp_rust_utils::{ | ||
| job_config::CompressionJobId, | ||
| task_io::compression::{ClpSCompressionOption, S3InputSource}, | ||
| }; | ||
| use serde::{Deserialize, Serialize}; | ||
| use spider_core::{ | ||
| task::ExecutionPolicy, | ||
| types::id::{JobId, ResourceGroupId}, | ||
| }; | ||
|
|
||
| use crate::error::Error; | ||
|
|
||
| /// The terminal outcome of a compression job. | ||
| #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] | ||
| pub enum CompressionJobOutcome { | ||
| /// The job completed successfully. | ||
| Succeeded, | ||
|
|
||
| /// The job failed with the given error. | ||
| Failed { error_message: String }, | ||
|
|
||
| /// The job was cancelled before reaching completion. | ||
| Cancelled, | ||
| } | ||
|
|
||
| /// Drives CLP S3 compression jobs on a Spider (Huntsman) cluster. | ||
| #[async_trait] | ||
| pub trait S3CompressionJobSubmitter: Clone + Send + Sync { | ||
| /// Builds the compression task graph for `input_sources` and registers it with Spider, without | ||
| /// starting it. | ||
| /// | ||
| /// # Parameters | ||
| /// | ||
| /// * `compression_job_id` - The unique ID of the CLP compression job. | ||
| /// * `resource_group_id` - The Spider resource group to register the job under. | ||
| /// * `clp_s_option` - `clp-s` tuning options shared by every task in the job. | ||
| /// * `dataset` - The dataset to compress into. | ||
| /// * `input_sources` - S3 input sources to compress, each paired with the execution policy to | ||
| /// apply to the compression task it creates. Each element represents an input to a | ||
| /// compression task. | ||
| /// * `commit_task_execution_policy` - The execution policy to apply to the job's commit task. | ||
| /// | ||
| /// # Returns | ||
| /// | ||
| /// The job ID issued by Spider on success. | ||
| /// | ||
| /// # Errors | ||
| /// | ||
| /// Implementations must document their error conditions. | ||
| async fn submit_s3_compression_job( | ||
| &self, | ||
| compression_job_id: CompressionJobId, | ||
| resource_group_id: ResourceGroupId, | ||
| clp_s_option: ClpSCompressionOption, | ||
| dataset: Option<String>, | ||
| input_sources: Vec<(S3InputSource, ExecutionPolicy)>, | ||
| commit_task_execution_policy: ExecutionPolicy, | ||
| ) -> Result<JobId, Error>; | ||
|
|
||
| /// Idempotently starts the job identified by `spider_job_id` (only if it hasn't already been | ||
| /// started) and waits until it reaches a terminal state. | ||
| /// | ||
| /// Safe to call regardless of whether the job is not-yet-started, already running, or already | ||
| /// terminal. | ||
| /// | ||
| /// # Parameters | ||
| /// | ||
| /// * `spider_job_id` - The job to start (if needed) and wait on. | ||
| /// * `initial_poll_backoff` - The delay before the first job-state poll. | ||
| /// * `max_poll_backoff` - The cap on the delay between job-state polls. | ||
| /// | ||
| /// # Returns | ||
| /// | ||
| /// The job's terminal outcome on success. | ||
| /// | ||
| /// # Errors | ||
| /// | ||
| /// Implementations must document their error conditions. | ||
| async fn run_s3_compression_job_to_completion( | ||
| &self, | ||
| spider_job_id: JobId, | ||
| initial_poll_backoff: Duration, | ||
| max_poll_backoff: Duration, | ||
| ) -> Result<CompressionJobOutcome, Error>; | ||
|
LinZhihao-723 marked this conversation as resolved.
|
||
| } | ||
1 change: 1 addition & 0 deletions
1
components/compression-coordinator/src/compression_job_submitter/spider.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| //! The crate-level error type for the compression coordinator. | ||
|
|
||
| /// Errors returned by the compression coordinator. | ||
| #[derive(Debug, thiserror::Error)] | ||
| pub enum Error {} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| //! The compression-job-submission API trait for driving CLP S3 compression jobs on a Spider | ||
| //! (Huntsman) cluster. | ||
|
|
||
| pub mod compression_job_submitter; | ||
| mod error; | ||
|
|
||
| pub use error::Error; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.