You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "mingmwang (via GitHub)" <gi...@apache.org> on 2023/03/01 03:02:16 UTC

[GitHub] [arrow-ballista] mingmwang commented on a diff in pull request #667: Add executor terminating status for graceful shutdown

mingmwang commented on code in PR #667:
URL: https://github.com/apache/arrow-ballista/pull/667#discussion_r1121076873


##########
ballista/executor/src/executor.rs:
##########
@@ -37,6 +40,20 @@ use futures::future::AbortHandle;
 
 use ballista_core::serde::scheduler::PartitionId;
 
+pub struct TasksDrainedFuture(pub Arc<Executor>);
+
+impl Future for TasksDrainedFuture {
+    type Output = ();
+
+    fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
+        if self.0.abort_handles.len() > 0 {
+            Poll::Pending
+        } else {
+            Poll::Ready(())
+        }
+    }
+}
+

Review Comment:
   In the `StopExecutorParams` struct, there is a `force` flag to tell the `Executor` whether it should quit immediately or waiting for draining all the running tasks. I'm not sure whether it is correctly implemented or not. Maybe you can take a look.
   
   ```rust
   pub struct StopExecutorParams {
       #[prost(string, tag = "1")]
       pub executor_id: ::prost::alloc::string::String,
       /// stop reason
       #[prost(string, tag = "2")]
       pub reason: ::prost::alloc::string::String,
       /// force to stop the executor immediately
       #[prost(bool, tag = "3")]
       pub force: bool,
   }
   ```



-- 
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