Move 17 library crates into crates/, CLI binary into bin/fxt, consolidate 10 test crates into testing/, split config crate from deployment config files. Root directory reduced from 38+ to ~17 directories. All Cargo.toml paths and build.rs proto refs updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
766 lines
27 KiB
Rust
766 lines
27 KiB
Rust
// This file is @generated by prost-build.
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StartTrainingRequest {
|
|
/// e.g., "TLOB", "MAMBA_2", "DQN", "PPO"
|
|
#[prost(string, tag = "1")]
|
|
pub model_type: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub data_source: ::core::option::Option<DataSource>,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub hyperparameters: ::core::option::Option<Hyperparameters>,
|
|
#[prost(bool, tag = "4")]
|
|
pub use_gpu: bool,
|
|
/// Optional user-provided description for the job.
|
|
#[prost(string, tag = "5")]
|
|
pub description: ::prost::alloc::string::String,
|
|
/// Optional tags for categorizing jobs
|
|
#[prost(map = "string, string", tag = "6")]
|
|
pub tags: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
::prost::alloc::string::String,
|
|
>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StartTrainingResponse {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "TrainingStatus", tag = "2")]
|
|
pub status: i32,
|
|
#[prost(string, tag = "3")]
|
|
pub message: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SubscribeToTrainingStatusRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
}
|
|
/// A single status update message streamed from the server.
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct TrainingStatusUpdate {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "TrainingStatus", tag = "2")]
|
|
pub status: i32,
|
|
/// e.g., 75.5 for 75.5%
|
|
#[prost(float, tag = "3")]
|
|
pub progress_percentage: f32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub current_epoch: u32,
|
|
#[prost(uint32, tag = "5")]
|
|
pub total_epochs: u32,
|
|
/// e.g., "loss", "accuracy", "sharpe_ratio"
|
|
#[prost(map = "string, float", tag = "6")]
|
|
pub metrics: ::std::collections::HashMap<::prost::alloc::string::String, f32>,
|
|
/// e.g., "Epoch 10/100 completed", "Error: CUDA out of memory"
|
|
#[prost(string, tag = "7")]
|
|
pub message: ::prost::alloc::string::String,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "8")]
|
|
pub timestamp: i64,
|
|
#[prost(message, optional, tag = "9")]
|
|
pub financial_metrics: ::core::option::Option<FinancialMetrics>,
|
|
#[prost(message, optional, tag = "10")]
|
|
pub resource_usage: ::core::option::Option<ResourceUsage>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StopTrainingRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
/// Optional reason for stopping
|
|
#[prost(string, tag = "2")]
|
|
pub reason: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StopTrainingResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub message: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct ListAvailableModelsRequest {}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListAvailableModelsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub models: ::prost::alloc::vec::Vec<ModelDefinition>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListTrainingJobsRequest {
|
|
#[prost(uint32, tag = "1")]
|
|
pub page: u32,
|
|
#[prost(uint32, tag = "2")]
|
|
pub page_size: u32,
|
|
#[prost(enumeration = "TrainingStatus", tag = "3")]
|
|
pub status_filter: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub model_type_filter: ::prost::alloc::string::String,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "5")]
|
|
pub start_time: i64,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "6")]
|
|
pub end_time: i64,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListTrainingJobsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub jobs: ::prost::alloc::vec::Vec<TrainingJobSummary>,
|
|
#[prost(uint32, tag = "2")]
|
|
pub total_count: u32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub page: u32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub page_size: u32,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetTrainingJobDetailsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetTrainingJobDetailsResponse {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub job_details: ::core::option::Option<TrainingJobDetails>,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct HealthCheckRequest {}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct HealthCheckResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub healthy: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub message: ::prost::alloc::string::String,
|
|
#[prost(map = "string, string", tag = "3")]
|
|
pub details: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
::prost::alloc::string::String,
|
|
>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct DataSource {
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "4")]
|
|
pub start_time: i64,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "5")]
|
|
pub end_time: i64,
|
|
#[prost(oneof = "data_source::Source", tags = "1, 2, 3")]
|
|
pub source: ::core::option::Option<data_source::Source>,
|
|
}
|
|
/// Nested message and enum types in `DataSource`.
|
|
pub mod data_source {
|
|
#[derive(Clone, PartialEq, ::prost::Oneof)]
|
|
pub enum Source {
|
|
#[prost(string, tag = "1")]
|
|
HistoricalDbQuery(::prost::alloc::string::String),
|
|
#[prost(string, tag = "2")]
|
|
RealTimeStreamTopic(::prost::alloc::string::String),
|
|
#[prost(string, tag = "3")]
|
|
FilePath(::prost::alloc::string::String),
|
|
}
|
|
}
|
|
/// Provides type-safe hyperparameter configuration.
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct Hyperparameters {
|
|
#[prost(oneof = "hyperparameters::ModelParams", tags = "1, 2, 3, 4, 5, 6")]
|
|
pub model_params: ::core::option::Option<hyperparameters::ModelParams>,
|
|
}
|
|
/// Nested message and enum types in `Hyperparameters`.
|
|
pub mod hyperparameters {
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
|
|
pub enum ModelParams {
|
|
#[prost(message, tag = "1")]
|
|
TlobParams(super::TlobParams),
|
|
#[prost(message, tag = "2")]
|
|
MambaParams(super::MambaParams),
|
|
#[prost(message, tag = "3")]
|
|
DqnParams(super::DqnParams),
|
|
#[prost(message, tag = "4")]
|
|
PpoParams(super::PpoParams),
|
|
#[prost(message, tag = "5")]
|
|
LiquidParams(super::LiquidParams),
|
|
#[prost(message, tag = "6")]
|
|
TftParams(super::TftParams),
|
|
}
|
|
}
|
|
/// TLOB (Time-Limit Order Book) Transformer parameters
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct TlobParams {
|
|
#[prost(uint32, tag = "1")]
|
|
pub epochs: u32,
|
|
#[prost(float, tag = "2")]
|
|
pub learning_rate: f32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub batch_size: u32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub sequence_length: u32,
|
|
#[prost(uint32, tag = "5")]
|
|
pub hidden_dim: u32,
|
|
#[prost(uint32, tag = "6")]
|
|
pub num_heads: u32,
|
|
#[prost(uint32, tag = "7")]
|
|
pub num_layers: u32,
|
|
#[prost(float, tag = "8")]
|
|
pub dropout_rate: f32,
|
|
#[prost(bool, tag = "9")]
|
|
pub use_positional_encoding: bool,
|
|
}
|
|
/// MAMBA-2 State Space Model parameters
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct MambaParams {
|
|
#[prost(uint32, tag = "1")]
|
|
pub epochs: u32,
|
|
#[prost(float, tag = "2")]
|
|
pub learning_rate: f32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub batch_size: u32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub state_dim: u32,
|
|
#[prost(uint32, tag = "5")]
|
|
pub hidden_dim: u32,
|
|
#[prost(uint32, tag = "6")]
|
|
pub num_layers: u32,
|
|
#[prost(float, tag = "7")]
|
|
pub dt_min: f32,
|
|
#[prost(float, tag = "8")]
|
|
pub dt_max: f32,
|
|
#[prost(bool, tag = "9")]
|
|
pub use_cuda_kernels: bool,
|
|
}
|
|
/// DQN (Deep Q-Network) parameters
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct DqnParams {
|
|
#[prost(uint32, tag = "1")]
|
|
pub epochs: u32,
|
|
#[prost(float, tag = "2")]
|
|
pub learning_rate: f32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub batch_size: u32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub replay_buffer_size: u32,
|
|
#[prost(float, tag = "5")]
|
|
pub epsilon_start: f32,
|
|
#[prost(float, tag = "6")]
|
|
pub epsilon_end: f32,
|
|
#[prost(uint32, tag = "7")]
|
|
pub epsilon_decay_steps: u32,
|
|
#[prost(float, tag = "8")]
|
|
pub gamma: f32,
|
|
#[prost(uint32, tag = "9")]
|
|
pub target_update_frequency: u32,
|
|
#[prost(bool, tag = "10")]
|
|
pub use_double_dqn: bool,
|
|
#[prost(bool, tag = "11")]
|
|
pub use_dueling: bool,
|
|
#[prost(bool, tag = "12")]
|
|
pub use_prioritized_replay: bool,
|
|
}
|
|
/// PPO (Proximal Policy Optimization) parameters
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct PpoParams {
|
|
#[prost(uint32, tag = "1")]
|
|
pub epochs: u32,
|
|
#[prost(float, tag = "2")]
|
|
pub learning_rate: f32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub batch_size: u32,
|
|
#[prost(float, tag = "4")]
|
|
pub clip_ratio: f32,
|
|
#[prost(float, tag = "5")]
|
|
pub value_loss_coef: f32,
|
|
#[prost(float, tag = "6")]
|
|
pub entropy_coef: f32,
|
|
#[prost(uint32, tag = "7")]
|
|
pub rollout_steps: u32,
|
|
#[prost(uint32, tag = "8")]
|
|
pub minibatch_size: u32,
|
|
#[prost(float, tag = "9")]
|
|
pub gae_lambda: f32,
|
|
}
|
|
/// Liquid Network parameters
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct LiquidParams {
|
|
#[prost(uint32, tag = "1")]
|
|
pub epochs: u32,
|
|
#[prost(float, tag = "2")]
|
|
pub learning_rate: f32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub batch_size: u32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub num_neurons: u32,
|
|
#[prost(float, tag = "5")]
|
|
pub tau: f32,
|
|
#[prost(float, tag = "6")]
|
|
pub sigma: f32,
|
|
#[prost(bool, tag = "7")]
|
|
pub use_adaptive_tau: bool,
|
|
}
|
|
/// Temporal Fusion Transformer parameters
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct TftParams {
|
|
#[prost(uint32, tag = "1")]
|
|
pub epochs: u32,
|
|
#[prost(float, tag = "2")]
|
|
pub learning_rate: f32,
|
|
#[prost(uint32, tag = "3")]
|
|
pub batch_size: u32,
|
|
#[prost(uint32, tag = "4")]
|
|
pub hidden_dim: u32,
|
|
#[prost(uint32, tag = "5")]
|
|
pub num_heads: u32,
|
|
#[prost(uint32, tag = "6")]
|
|
pub num_layers: u32,
|
|
#[prost(uint32, tag = "7")]
|
|
pub lookback_window: u32,
|
|
#[prost(uint32, tag = "8")]
|
|
pub forecast_horizon: u32,
|
|
#[prost(float, tag = "9")]
|
|
pub dropout_rate: f32,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ModelDefinition {
|
|
#[prost(string, tag = "1")]
|
|
pub model_type: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub default_hyperparameters: ::core::option::Option<Hyperparameters>,
|
|
#[prost(string, repeated, tag = "4")]
|
|
pub required_features: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
#[prost(uint32, tag = "5")]
|
|
pub estimated_training_time_minutes: u32,
|
|
#[prost(bool, tag = "6")]
|
|
pub requires_gpu: bool,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct TrainingJobSummary {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub model_type: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "TrainingStatus", tag = "3")]
|
|
pub status: i32,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "4")]
|
|
pub created_at: i64,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "5")]
|
|
pub started_at: i64,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "6")]
|
|
pub completed_at: i64,
|
|
#[prost(string, tag = "7")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(float, tag = "8")]
|
|
pub final_loss: f32,
|
|
#[prost(float, tag = "9")]
|
|
pub best_validation_score: f32,
|
|
#[prost(map = "string, string", tag = "10")]
|
|
pub tags: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
::prost::alloc::string::String,
|
|
>,
|
|
}
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct TrainingJobDetails {
|
|
#[prost(string, tag = "1")]
|
|
pub job_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub model_type: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "TrainingStatus", tag = "3")]
|
|
pub status: i32,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "4")]
|
|
pub created_at: i64,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "5")]
|
|
pub started_at: i64,
|
|
/// Unix timestamp in seconds
|
|
#[prost(int64, tag = "6")]
|
|
pub completed_at: i64,
|
|
#[prost(string, tag = "7")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(message, optional, tag = "8")]
|
|
pub hyperparameters: ::core::option::Option<Hyperparameters>,
|
|
#[prost(message, optional, tag = "9")]
|
|
pub data_source: ::core::option::Option<DataSource>,
|
|
#[prost(message, repeated, tag = "10")]
|
|
pub status_history: ::prost::alloc::vec::Vec<TrainingStatusUpdate>,
|
|
#[prost(message, optional, tag = "11")]
|
|
pub final_financial_metrics: ::core::option::Option<FinancialMetrics>,
|
|
#[prost(string, tag = "12")]
|
|
pub model_artifact_path: ::prost::alloc::string::String,
|
|
#[prost(map = "string, string", tag = "13")]
|
|
pub tags: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
::prost::alloc::string::String,
|
|
>,
|
|
#[prost(string, tag = "14")]
|
|
pub error_message: ::prost::alloc::string::String,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct FinancialMetrics {
|
|
#[prost(float, tag = "1")]
|
|
pub simulated_return: f32,
|
|
#[prost(float, tag = "2")]
|
|
pub sharpe_ratio: f32,
|
|
#[prost(float, tag = "3")]
|
|
pub max_drawdown: f32,
|
|
#[prost(float, tag = "4")]
|
|
pub hit_rate: f32,
|
|
#[prost(float, tag = "5")]
|
|
pub avg_prediction_error_bps: f32,
|
|
#[prost(float, tag = "6")]
|
|
pub risk_adjusted_return: f32,
|
|
#[prost(float, tag = "7")]
|
|
pub var_5pct: f32,
|
|
#[prost(float, tag = "8")]
|
|
pub expected_shortfall: f32,
|
|
}
|
|
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
|
|
pub struct ResourceUsage {
|
|
#[prost(float, tag = "1")]
|
|
pub cpu_usage_percent: f32,
|
|
#[prost(float, tag = "2")]
|
|
pub memory_usage_gb: f32,
|
|
#[prost(float, tag = "3")]
|
|
pub gpu_usage_percent: f32,
|
|
#[prost(float, tag = "4")]
|
|
pub gpu_memory_usage_gb: f32,
|
|
#[prost(uint32, tag = "5")]
|
|
pub active_workers: u32,
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum TrainingStatus {
|
|
Unknown = 0,
|
|
Pending = 1,
|
|
Running = 2,
|
|
Completed = 3,
|
|
Failed = 4,
|
|
Stopped = 5,
|
|
Paused = 6,
|
|
}
|
|
impl TrainingStatus {
|
|
/// String value of the enum field names used in the ProtoBuf definition.
|
|
///
|
|
/// The values are not transformed in any way and thus are considered stable
|
|
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
|
|
pub fn as_str_name(&self) -> &'static str {
|
|
match self {
|
|
Self::Unknown => "UNKNOWN",
|
|
Self::Pending => "PENDING",
|
|
Self::Running => "RUNNING",
|
|
Self::Completed => "COMPLETED",
|
|
Self::Failed => "FAILED",
|
|
Self::Stopped => "STOPPED",
|
|
Self::Paused => "PAUSED",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"UNKNOWN" => Some(Self::Unknown),
|
|
"PENDING" => Some(Self::Pending),
|
|
"RUNNING" => Some(Self::Running),
|
|
"COMPLETED" => Some(Self::Completed),
|
|
"FAILED" => Some(Self::Failed),
|
|
"STOPPED" => Some(Self::Stopped),
|
|
"PAUSED" => Some(Self::Paused),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Generated client implementations.
|
|
pub mod ml_training_service_client {
|
|
#![allow(
|
|
unused_variables,
|
|
dead_code,
|
|
missing_docs,
|
|
clippy::wildcard_imports,
|
|
clippy::let_unit_value,
|
|
)]
|
|
use tonic::codegen::*;
|
|
use tonic::codegen::http::Uri;
|
|
/// The main ML Training Service
|
|
#[derive(Debug, Clone)]
|
|
pub struct MlTrainingServiceClient<T> {
|
|
inner: tonic::client::Grpc<T>,
|
|
}
|
|
impl MlTrainingServiceClient<tonic::transport::Channel> {
|
|
/// Attempt to create a new client by connecting to a given endpoint.
|
|
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
|
|
where
|
|
D: TryInto<tonic::transport::Endpoint>,
|
|
D::Error: Into<StdError>,
|
|
{
|
|
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
|
|
Ok(Self::new(conn))
|
|
}
|
|
}
|
|
impl<T> MlTrainingServiceClient<T>
|
|
where
|
|
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
|
T::Error: Into<StdError>,
|
|
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
|
|
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
|
|
{
|
|
pub fn new(inner: T) -> Self {
|
|
let inner = tonic::client::Grpc::new(inner);
|
|
Self { inner }
|
|
}
|
|
pub fn with_origin(inner: T, origin: Uri) -> Self {
|
|
let inner = tonic::client::Grpc::with_origin(inner, origin);
|
|
Self { inner }
|
|
}
|
|
pub fn with_interceptor<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> MlTrainingServiceClient<InterceptedService<T, F>>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
T::ResponseBody: Default,
|
|
T: tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
Response = http::Response<
|
|
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
|
|
>,
|
|
>,
|
|
<T as tonic::codegen::Service<
|
|
http::Request<tonic::body::BoxBody>,
|
|
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
|
|
{
|
|
MlTrainingServiceClient::new(InterceptedService::new(inner, interceptor))
|
|
}
|
|
/// Compress requests with the given encoding.
|
|
///
|
|
/// This requires the server to support it otherwise it might respond with an
|
|
/// error.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.send_compressed(encoding);
|
|
self
|
|
}
|
|
/// Enable decompressing responses.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.inner = self.inner.accept_compressed(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_decoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[must_use]
|
|
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
self.inner = self.inner.max_encoding_message_size(limit);
|
|
self
|
|
}
|
|
/// Initiates a training job. Returns a job_id immediately.
|
|
pub async fn start_training(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StartTrainingRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::StartTrainingResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/StartTraining",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("ml_training.MLTrainingService", "StartTraining"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Subscribes to real-time status updates for a specific job.
|
|
///
|
|
/// The server will stream updates as they happen until the job completes or the client disconnects.
|
|
pub async fn subscribe_to_training_status(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::SubscribeToTrainingStatusRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<tonic::codec::Streaming<super::TrainingStatusUpdate>>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/SubscribeToTrainingStatus",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"ml_training.MLTrainingService",
|
|
"SubscribeToTrainingStatus",
|
|
),
|
|
);
|
|
self.inner.server_streaming(req, path, codec).await
|
|
}
|
|
/// Stops a running training job. This is an idempotent operation.
|
|
pub async fn stop_training(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::StopTrainingRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::StopTrainingResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/StopTraining",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("ml_training.MLTrainingService", "StopTraining"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Lists models available for training and their default parameter templates.
|
|
pub async fn list_available_models(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ListAvailableModelsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListAvailableModelsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/ListAvailableModels",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"ml_training.MLTrainingService",
|
|
"ListAvailableModels",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Fetches a paginated list of historical training jobs.
|
|
pub async fn list_training_jobs(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::ListTrainingJobsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListTrainingJobsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/ListTrainingJobs",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new("ml_training.MLTrainingService", "ListTrainingJobs"),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Get detailed information about a specific training job.
|
|
pub async fn get_training_job_details(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::GetTrainingJobDetailsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetTrainingJobDetailsResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/GetTrainingJobDetails",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(
|
|
GrpcMethod::new(
|
|
"ml_training.MLTrainingService",
|
|
"GetTrainingJobDetails",
|
|
),
|
|
);
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
/// Health check for the service
|
|
pub async fn health_check(
|
|
&mut self,
|
|
request: impl tonic::IntoRequest<super::HealthCheckRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::HealthCheckResponse>,
|
|
tonic::Status,
|
|
> {
|
|
self.inner
|
|
.ready()
|
|
.await
|
|
.map_err(|e| {
|
|
tonic::Status::unknown(
|
|
format!("Service was not ready: {}", e.into()),
|
|
)
|
|
})?;
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let path = http::uri::PathAndQuery::from_static(
|
|
"/ml_training.MLTrainingService/HealthCheck",
|
|
);
|
|
let mut req = request.into_request();
|
|
req.extensions_mut()
|
|
.insert(GrpcMethod::new("ml_training.MLTrainingService", "HealthCheck"));
|
|
self.inner.unary(req, path, codec).await
|
|
}
|
|
}
|
|
}
|