#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SendTasksReq {
#[prost(message, repeated, tag = "1")]
pub stage_plans: ::prost::alloc::vec::Vec<StagePlan>,
#[prost(message, repeated, tag = "2")]
pub tasks: ::prost::alloc::vec::Vec<TaskId>,
#[prost(message, optional, tag = "3")]
pub job_task_distribution: ::core::option::Option<TaskDistribution>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SendTasksResp {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StageId {
#[prost(string, tag = "1")]
pub job_id: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub stage: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TaskId {
#[prost(string, tag = "1")]
pub job_id: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub stage: u32,
#[prost(uint32, tag = "3")]
pub partition: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StagePlan {
#[prost(message, optional, tag = "1")]
pub stage_id: ::core::option::Option<StageId>,
#[prost(bytes = "vec", tag = "2")]
pub plan: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetJobStatusReq {
#[prost(string, optional, tag = "1")]
pub job_id: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetJobStatusResp {
#[prost(message, repeated, tag = "1")]
pub stage_infos: ::prost::alloc::vec::Vec<StageInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StageInfo {
#[prost(message, optional, tag = "1")]
pub stage_id: ::core::option::Option<StageId>,
#[prost(int64, tag = "2")]
pub created_at_ms: i64,
#[prost(uint32, repeated, tag = "3")]
pub assigned_partitions: ::prost::alloc::vec::Vec<u32>,
#[prost(message, repeated, tag = "4")]
pub task_set_infos: ::prost::alloc::vec::Vec<TaskSetInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskSetInfo {
#[prost(uint32, repeated, tag = "1")]
pub running_partitions: ::prost::alloc::vec::Vec<u32>,
#[prost(message, repeated, tag = "2")]
pub dropped_partitions: ::prost::alloc::vec::Vec<DroppedPartition>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DroppedPartition {
#[prost(uint32, tag = "1")]
pub partition: u32,
#[prost(message, optional, tag = "2")]
pub metrics: ::core::option::Option<TaskMetrics>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TaskMetrics {
#[prost(uint64, tag = "1")]
pub output_bytes: u64,
#[prost(uint64, tag = "2")]
pub output_rows: u64,
#[prost(bool, tag = "3")]
pub completed: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CleanupJobReq {
#[prost(string, tag = "1")]
pub job_id: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CleanupJobResp {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DistPhysicalPlanNode {
#[prost(oneof = "dist_physical_plan_node::DistPhysicalPlanType", tags = "1")]
pub dist_physical_plan_type:
::core::option::Option<dist_physical_plan_node::DistPhysicalPlanType>,
}
pub mod dist_physical_plan_node {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum DistPhysicalPlanType {
#[prost(message, tag = "1")]
Proxy(super::ProxyExecNode),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ProxyExecNode {
#[prost(message, optional, tag = "1")]
pub delegated_stage_id: ::core::option::Option<StageId>,
#[prost(string, tag = "2")]
pub delegated_plan_name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub delegated_task_distribution: ::core::option::Option<TaskDistribution>,
#[prost(message, optional, tag = "4")]
pub schema: ::core::option::Option<::datafusion_proto::protobuf::Schema>,
#[prost(message, optional, tag = "5")]
pub partitioning: ::core::option::Option<::datafusion_proto::protobuf::Partitioning>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TaskDistribution {
#[prost(message, repeated, tag = "1")]
pub distribution: ::prost::alloc::vec::Vec<TaskNode>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TaskNode {
#[prost(message, optional, tag = "1")]
pub task_id: ::core::option::Option<TaskId>,
#[prost(message, optional, tag = "2")]
pub node_id: ::core::option::Option<NodeId>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NodeId {
#[prost(string, tag = "1")]
pub host: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub port: u32,
}
pub mod dist_tonic_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct DistTonicServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DistTonicServiceClient<tonic::transport::Channel> {
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> DistTonicServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
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,
) -> DistTonicServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
DistTonicServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn send_tasks(
&mut self,
request: impl tonic::IntoRequest<super::SendTasksReq>,
) -> std::result::Result<tonic::Response<super::SendTasksResp>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/network_tonic.DistTonicService/SendTasks");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"network_tonic.DistTonicService",
"SendTasks",
));
self.inner.unary(req, path, codec).await
}
pub async fn execute_task(
&mut self,
request: impl tonic::IntoRequest<super::TaskId>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<::arrow_flight::FlightData>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/network_tonic.DistTonicService/ExecuteTask");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"network_tonic.DistTonicService",
"ExecuteTask",
));
self.inner.server_streaming(req, path, codec).await
}
pub async fn get_job_status(
&mut self,
request: impl tonic::IntoRequest<super::GetJobStatusReq>,
) -> std::result::Result<tonic::Response<super::GetJobStatusResp>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/network_tonic.DistTonicService/GetJobStatus",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"network_tonic.DistTonicService",
"GetJobStatus",
));
self.inner.unary(req, path, codec).await
}
pub async fn cleanup_job(
&mut self,
request: impl tonic::IntoRequest<super::CleanupJobReq>,
) -> std::result::Result<tonic::Response<super::CleanupJobResp>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/network_tonic.DistTonicService/CleanupJob");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"network_tonic.DistTonicService",
"CleanupJob",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod dist_tonic_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait DistTonicService: std::marker::Send + std::marker::Sync + 'static {
async fn send_tasks(
&self,
request: tonic::Request<super::SendTasksReq>,
) -> std::result::Result<tonic::Response<super::SendTasksResp>, tonic::Status>;
type ExecuteTaskStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<::arrow_flight::FlightData, tonic::Status>,
> + std::marker::Send
+ 'static;
async fn execute_task(
&self,
request: tonic::Request<super::TaskId>,
) -> std::result::Result<tonic::Response<Self::ExecuteTaskStream>, tonic::Status>;
async fn get_job_status(
&self,
request: tonic::Request<super::GetJobStatusReq>,
) -> std::result::Result<tonic::Response<super::GetJobStatusResp>, tonic::Status>;
async fn cleanup_job(
&self,
request: tonic::Request<super::CleanupJobReq>,
) -> std::result::Result<tonic::Response<super::CleanupJobResp>, tonic::Status>;
}
#[derive(Debug)]
pub struct DistTonicServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> DistTonicServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for DistTonicServiceServer<T>
where
T: DistTonicService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/network_tonic.DistTonicService/SendTasks" => {
#[allow(non_camel_case_types)]
struct SendTasksSvc<T: DistTonicService>(pub Arc<T>);
impl<T: DistTonicService> tonic::server::UnaryService<super::SendTasksReq> for SendTasksSvc<T> {
type Response = super::SendTasksResp;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::SendTasksReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DistTonicService>::send_tasks(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SendTasksSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/network_tonic.DistTonicService/ExecuteTask" => {
#[allow(non_camel_case_types)]
struct ExecuteTaskSvc<T: DistTonicService>(pub Arc<T>);
impl<T: DistTonicService> tonic::server::ServerStreamingService<super::TaskId>
for ExecuteTaskSvc<T>
{
type Response = ::arrow_flight::FlightData;
type ResponseStream = T::ExecuteTaskStream;
type Future =
BoxFuture<tonic::Response<Self::ResponseStream>, tonic::Status>;
fn call(&mut self, request: tonic::Request<super::TaskId>) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DistTonicService>::execute_task(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ExecuteTaskSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/network_tonic.DistTonicService/GetJobStatus" => {
#[allow(non_camel_case_types)]
struct GetJobStatusSvc<T: DistTonicService>(pub Arc<T>);
impl<T: DistTonicService> tonic::server::UnaryService<super::GetJobStatusReq>
for GetJobStatusSvc<T>
{
type Response = super::GetJobStatusResp;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetJobStatusReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DistTonicService>::get_job_status(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetJobStatusSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/network_tonic.DistTonicService/CleanupJob" => {
#[allow(non_camel_case_types)]
struct CleanupJobSvc<T: DistTonicService>(pub Arc<T>);
impl<T: DistTonicService> tonic::server::UnaryService<super::CleanupJobReq> for CleanupJobSvc<T> {
type Response = super::CleanupJobResp;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CleanupJobReq>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DistTonicService>::cleanup_job(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CleanupJobSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for DistTonicServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "network_tonic.DistTonicService";
impl<T> tonic::server::NamedService for DistTonicServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}