Skip to content
This repository was archived by the owner on May 4, 2026. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
dockerfile: docker/p2p.dockerfile
# name of the docker image
image_name: p2p-demo
# push: 'true'
push: 'true'
docker_cache_enabled: true
secrets: inherit
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion cml-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ serde_json = "1.0.96"
thiserror = "1.0.40"
tokio = { version = "1.28.0", features = ["time", "macros", "signal"] }
uuid = { version = "1.3.2", features = ["serde"] }
time = { version = "0.3.21", features = ["std", "serde-human-readable", "parsing"] }

cml-core = { path = "../cml-core" }
strum_macros = "0.24.3"
prometheus-client = "0.20.0"
strum = "0.24.1"
base64 = "0.21.0"
rand = "0.8.5"
tower = "0.4.13"
pin-project = "1.0.12"

cml-core = { path = "../cml-core" }
11 changes: 6 additions & 5 deletions cml-protocol/src/resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use deployment::{CreateDeploymentRequest, GetDeploymentResponse, GetDeploymentSt
use reqwest::StatusCode;
use reservation::{CreateReservationRequest, ReservationInfo};
use thiserror::Error;
use time::OffsetDateTime;
use uuid::Uuid;

pub mod deployment;
Expand All @@ -15,12 +16,12 @@ pub enum ResourceError {
#[error("error occurred while querying the resource manager: {0}")]
Request(#[from] reqwest::Error),

#[error("allocation failed with the following status code: {0}")]
Allocation(StatusCode),

#[error("resource {0} with ID {1} not found")]
NotFound(String, Uuid),

#[error("allocation failed with the following status code: {0}")]
Allocation(StatusCode),

#[error("the resource manager returned the following status code: {0}")]
Manager(StatusCode),

Expand All @@ -30,8 +31,8 @@ pub enum ResourceError {
#[error("unknown reservation status: {0}")]
UnknownReservationStatus(#[from] strum::ParseError),

#[error("an error occurred: {0}")]
Custom(String),
#[error("an error occurred: {0} at {1}")]
Custom(String, OffsetDateTime),
}

#[async_trait]
Expand Down
7 changes: 5 additions & 2 deletions p2p-app/src/resource/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ use time::OffsetDateTime;
#[derive(Debug, Deserialize)]
pub struct ErrorResponse {
error: String,
fields: Vec<String>,
fields: Option<Vec<String>>,
#[serde(with = "time::serde::rfc3339")]
time: OffsetDateTime,
}

impl From<ErrorResponse> for ResourceError {
fn from(error: ErrorResponse) -> Self {
ResourceError::Custom(format!("operation failed {} at {}", error.error, error.time))
match error.fields {
None => ResourceError::Custom(error.error, error.time),
Some(f) => ResourceError::Custom(format!("{}, fields {f:?}", error.error), error.time),
}
}
}