yahoNanJing commented on a change in pull request #1560:
URL: https://github.com/apache/arrow-datafusion/pull/1560#discussion_r787422427
##########
File path: ballista/rust/scheduler/src/lib.rs
##########
@@ -112,17 +140,171 @@ impl SchedulerServer {
tokio::spawn(async move {
state_clone.synchronize_job_status_loop().await });
Self {
- caller_ip,
state,
start_time: SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_millis(),
+ policy,
+ scheduler_env,
+ executors_client: Arc::new(RwLock::new(HashMap::new())),
}
}
- pub fn set_caller_ip(&mut self, ip: IpAddr) {
- self.caller_ip = ip;
+ async fn schedule_job(&self, job_id: String) -> Result<(), BallistaError> {
+ let alive_executors = self
+ .state
+ .get_alive_executors_metadata_within_one_minute()
+ .await?;
+ let alive_executors: HashMap<String, ExecutorMeta> = alive_executors
+ .into_iter()
+ .map(|e| (e.id.clone(), e))
+ .collect();
+ let available_executors =
self.state.get_available_executors_data().await?;
+ let mut available_executors: Vec<ExecutorData> = available_executors
+ .into_iter()
+ .filter(|e| alive_executors.contains_key(&e.executor_id))
+ .collect();
+
+ // In case of there's no enough resources, reschedule the tasks of the
job
+ if available_executors.is_empty() {
+ let tx_job = self.scheduler_env.as_ref().unwrap().tx_job.clone();
+ // TODO
Review comment:
Forgot to add comments. Maybe it's better to use an exclusive runtime
for this kind task scheduling.
--
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]