Ted-Jiang commented on code in PR #188:
URL: https://github.com/apache/arrow-ballista/pull/188#discussion_r963439767


##########
ballista/rust/scheduler/src/state/task_manager.rs:
##########
@@ -519,4 +589,54 @@ impl<T: 'static + AsLogicalPlan, U: 'static + 
AsExecutionPlan> TaskManager<T, U>
             .take(7)
             .collect()
     }
+
+    async fn clean_up_job_data(
+        state: Arc<dyn StateBackendClient>,
+        active_job_cache: ExecutionGraphCache,
+        failed: bool,
+        job_id: String,
+        executor_manager: Option<ExecutorManager>,
+    ) -> Result<()> {
+        let mut active_graph_cache = active_job_cache.write().await;
+        active_graph_cache.remove(&job_id);
+
+        let keyspace = if failed {
+            Keyspace::FailedJobs
+        } else {
+            Keyspace::CompletedJobs
+        };
+
+        let lock = state.lock(keyspace.clone(), "").await?;
+        with_lock(lock, state.delete(keyspace, &job_id)).await?;
+
+        executor_manager
+            .map(|em| async { Self::clean_up_executors_data(job_id.clone(), 
em).await });
+        Ok(())
+    }
+
+    async fn clean_up_executors_data(job_id: String, executor_manager: 
ExecutorManager) {
+        let alive_executors = 
executor_manager.get_alive_executors_within_one_minute();
+        for executor in alive_executors {
+            let job_id_clone = job_id.to_owned();
+            let executor_manager_clone = executor_manager.clone();

Review Comment:
   I think each SQL sends an RPC to all executors is not a good idea (for 
interactive query finish in ms)🤔 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to