milenkovicm commented on code in PR #1478:
URL: 
https://github.com/apache/datafusion-ballista/pull/1478#discussion_r2871507776


##########
ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs:
##########
@@ -108,10 +110,33 @@ impl<T: 'static + AsLogicalPlan, U: 'static + 
AsExecutionPlan>
                 let state = self.state.clone();
                 tokio::spawn(async move {
                     let event = if let Err(e) = state
-                        .submit_job(&job_id, &job_name, session_ctx, &plan, 
queued_at)
+                        .submit_job(
+                            &job_id,
+                            &job_name,
+                            session_ctx,
+                            &plan,
+                            queued_at,
+                            subscriber.clone(),
+                        )
                         .await
                     {
+                        let error = e.to_string();
                         let fail_message = format!("Error planning job 
{job_id}: {e:?}");
+
+                        // this is a corner case, as most of job status 
changes are handled in
+                        // job state, after job is submitted to job state
+                        if let Some(subscriber) = subscriber {
+                            let job_status = JobStatus {
+                                job_id: job_id.clone(),
+                                job_name,
+                                status: 
Some(ballista_core::serde::protobuf::job_status::Status::Failed(
+                                    FailedJob { error, queued_at, started_at: 
timestamp_millis(), ended_at: timestamp_millis() }
+                                ))
+                            };
+
+                            let _ = subscriber.send(job_status).await;

Review Comment:
   i agree with you, but it will log errors even if client disconnects so thats 
why i did not add it. will add warn logs 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to