@@ -22,12 +22,16 @@ use graphviz_rust::printer::PrinterContext;
22
22
use warp:: Rejection ;
23
23
24
24
#[ derive( Debug , serde:: Serialize ) ]
25
- struct StateResponse {
26
- executors : Vec < ExecutorMetaResponse > ,
25
+ struct SchedulerStateResponse {
27
26
started : u128 ,
28
27
version : & ' static str ,
29
28
}
30
29
30
+ #[ derive( Debug , serde:: Serialize ) ]
31
+ struct ExecutorsResponse {
32
+ executors : Vec < ExecutorMetaResponse > ,
33
+ }
34
+
31
35
#[ derive( Debug , serde:: Serialize ) ]
32
36
pub struct ExecutorMetaResponse {
33
37
pub id : String ,
@@ -45,12 +49,21 @@ pub struct JobResponse {
45
49
pub percent_complete : u8 ,
46
50
}
47
51
48
- /// Return current scheduler state, including list of executors and active, completed, and failed
49
- /// job ids.
50
- pub ( crate ) async fn get_state < T : AsLogicalPlan , U : AsExecutionPlan > (
52
+ /// Return current scheduler state
53
+ pub ( crate ) async fn get_scheduler_state < T : AsLogicalPlan , U : AsExecutionPlan > (
54
+ data_server : SchedulerServer < T , U > ,
55
+ ) -> Result < impl warp:: Reply , Rejection > {
56
+ let response = SchedulerStateResponse {
57
+ started : data_server. start_time ,
58
+ version : BALLISTA_VERSION ,
59
+ } ;
60
+ Ok ( warp:: reply:: json ( & response) )
61
+ }
62
+
63
+ /// Return list of executors
64
+ pub ( crate ) async fn get_executors < T : AsLogicalPlan , U : AsExecutionPlan > (
51
65
data_server : SchedulerServer < T , U > ,
52
66
) -> Result < impl warp:: Reply , Rejection > {
53
- // TODO: Display last seen information in UI
54
67
let state = data_server. state ;
55
68
let executors: Vec < ExecutorMetaResponse > = state
56
69
. executor_manager
@@ -66,12 +79,7 @@ pub(crate) async fn get_state<T: AsLogicalPlan, U: AsExecutionPlan>(
66
79
} )
67
80
. collect ( ) ;
68
81
69
- let response = StateResponse {
70
- executors,
71
- started : data_server. start_time ,
72
- version : BALLISTA_VERSION ,
73
- } ;
74
- Ok ( warp:: reply:: json ( & response) )
82
+ Ok ( warp:: reply:: json ( & executors) )
75
83
}
76
84
77
85
/// Return list of jobs
0 commit comments