This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new 63727df Avoid sleeping between tasks (#698)
63727df is described below
commit 63727df03472cd5ee0cff85371b62dfae6131493
Author: Daniƫl Heres <[email protected]>
AuthorDate: Fri Jul 9 11:28:32 2021 +0200
Avoid sleeping between tasks (#698)
---
ballista/rust/executor/src/execution_loop.rs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ballista/rust/executor/src/execution_loop.rs
b/ballista/rust/executor/src/execution_loop.rs
index 17a8d8c..17f6e4d 100644
--- a/ballista/rust/executor/src/execution_loop.rs
+++ b/ballista/rust/executor/src/execution_loop.rs
@@ -49,6 +49,10 @@ pub async fn poll_loop(
let task_status: Vec<TaskStatus> =
sample_tasks_status(&mut task_status_receiver).await;
+ // Keeps track of whether we received task in last iteration
+ // to avoid going in sleep mode between polling
+ let mut active_job = false;
+
let poll_work_result: anyhow::Result<
tonic::Response<PollWorkResult>,
tonic::Status,
@@ -73,14 +77,18 @@ pub async fn poll_loop(
task,
)
.await;
+ active_job = true;
+ } else {
+ active_job = false;
}
}
Err(error) => {
warn!("Executor registration failed. If this continues to
happen the executor might be marked as dead by the scheduler. Error: {}",
error);
}
}
-
- tokio::time::sleep(Duration::from_millis(250)).await;
+ if !active_job {
+ tokio::time::sleep(Duration::from_millis(100)).await;
+ }
}
}