You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/25 19:29:24 UTC

[GitHub] [arrow-datafusion] yordan-pavlov commented on a change in pull request #1883: Separate cpu-bound (query-execution) and IO-bound(heartbeat) to …

yordan-pavlov commented on a change in pull request #1883:
URL: https://github.com/apache/arrow-datafusion/pull/1883#discussion_r815037476



##########
File path: ballista/rust/executor/src/cpu_bound_executor.rs
##########
@@ -0,0 +1,377 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//Inspire by https://thenewstack.io/using-rustlangs-async-tokio-runtime-for-cpu-bound-tasks/
+//! This module contains a dedicated thread pool for running "cpu
+//! intensive" workloads such as DataFusion plans
+
+//! This module contains a dedicated thread pool for running "cpu
+//! intensive" workloads such as DataFusion plans
+
+use log::warn;
+use parking_lot::Mutex;
+use std::{pin::Pin, sync::Arc};
+use tokio::sync::oneshot::Receiver;
+
+use futures::Future;
+
+/// The type of thing that the dedicated executor runs
+type Task = Pin<Box<dyn Future<Output = ()> + Send>>;
+
+/// Runs futures (and any `tasks` that are `tokio::task::spawned` by
+/// them) on a separate tokio runtime
+#[derive(Clone)]
+pub struct DedicatedExecutor {

Review comment:
       I think it would be useful to add some comments to explain why a dedicated executor is necessary / useful; maybe even include a link to @alamb's blog post on the topic




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org