@@ -21,7 +21,6 @@ use std::net::SocketAddr;
2121use std:: sync:: atomic:: Ordering ;
2222use std:: sync:: Arc ;
2323use std:: time:: { Duration , Instant , UNIX_EPOCH } ;
24- use std:: { env, io} ;
2524
2625use anyhow:: { Context , Result } ;
2726use arrow_flight:: flight_service_server:: FlightServiceServer ;
@@ -37,7 +36,6 @@ use tokio::signal;
3736use tokio:: sync:: mpsc;
3837use tokio:: task:: JoinHandle ;
3938use tokio:: { fs, time} ;
40- use tracing_subscriber:: EnvFilter ;
4139use uuid:: Uuid ;
4240
4341use datafusion:: execution:: runtime_env:: { RuntimeConfig , RuntimeEnv } ;
@@ -98,57 +96,20 @@ pub struct ExecutorProcessConfig {
9896 pub executor_heartbeat_interval_seconds : u64 ,
9997 /// Optional execution engine to use to execute physical plans, will default to
10098 /// DataFusion if none is provided.
101- pub execution_engine : Option < Arc < dyn ExecutionEngine > > ,
99+ pub override_execution_engine : Option < Arc < dyn ExecutionEngine > > ,
102100 /// Overrides default function registry
103- pub function_registry : Option < Arc < BallistaFunctionRegistry > > ,
101+ pub override_function_registry : Option < Arc < BallistaFunctionRegistry > > ,
104102 /// [RuntimeProducer] override option
105- pub runtime_producer : Option < RuntimeProducer > ,
103+ pub override_runtime_producer : Option < RuntimeProducer > ,
106104 /// [ConfigProducer] override option
107- pub config_producer : Option < ConfigProducer > ,
105+ pub override_config_producer : Option < ConfigProducer > ,
108106 /// [PhysicalExtensionCodec] override option
109- pub logical_codec : Option < Arc < dyn LogicalExtensionCodec > > ,
107+ pub override_logical_codec : Option < Arc < dyn LogicalExtensionCodec > > ,
110108 /// [PhysicalExtensionCodec] override option
111- pub physical_codec : Option < Arc < dyn PhysicalExtensionCodec > > ,
109+ pub override_physical_codec : Option < Arc < dyn PhysicalExtensionCodec > > ,
112110}
113111
114112pub async fn start_executor_process ( opt : Arc < ExecutorProcessConfig > ) -> Result < ( ) > {
115- let rust_log = env:: var ( EnvFilter :: DEFAULT_ENV ) ;
116- let log_filter =
117- EnvFilter :: new ( rust_log. unwrap_or ( opt. special_mod_log_level . clone ( ) ) ) ;
118- // File layer
119- if let Some ( log_dir) = opt. log_dir . clone ( ) {
120- let log_file = match opt. log_rotation_policy {
121- LogRotationPolicy :: Minutely => {
122- tracing_appender:: rolling:: minutely ( log_dir, & opt. log_file_name_prefix )
123- }
124- LogRotationPolicy :: Hourly => {
125- tracing_appender:: rolling:: hourly ( log_dir, & opt. log_file_name_prefix )
126- }
127- LogRotationPolicy :: Daily => {
128- tracing_appender:: rolling:: daily ( log_dir, & opt. log_file_name_prefix )
129- }
130- LogRotationPolicy :: Never => {
131- tracing_appender:: rolling:: never ( log_dir, & opt. log_file_name_prefix )
132- }
133- } ;
134- tracing_subscriber:: fmt ( )
135- . with_ansi ( false )
136- . with_thread_names ( opt. print_thread_info )
137- . with_thread_ids ( opt. print_thread_info )
138- . with_writer ( log_file)
139- . with_env_filter ( log_filter)
140- . init ( ) ;
141- } else {
142- // Console layer
143- tracing_subscriber:: fmt ( )
144- . with_ansi ( false )
145- . with_thread_names ( opt. print_thread_info )
146- . with_thread_ids ( opt. print_thread_info )
147- . with_writer ( io:: stdout)
148- . with_env_filter ( log_filter)
149- . init ( ) ;
150- }
151-
152113 let addr = format ! ( "{}:{}" , opt. bind_host, opt. port) ;
153114 let addr = addr
154115 . parse ( )
@@ -194,23 +155,26 @@ pub async fn start_executor_process(opt: Arc<ExecutorProcessConfig>) -> Result<(
194155 // put them to session config
195156 let metrics_collector = Arc :: new ( LoggingMetricsCollector :: default ( ) ) ;
196157 let config_producer = opt
197- . config_producer
158+ . override_config_producer
198159 . clone ( )
199160 . unwrap_or_else ( || Arc :: new ( default_config_producer) ) ;
200161
201162 let wd = work_dir. clone ( ) ;
202- let runtime_producer: RuntimeProducer = Arc :: new ( move |_| {
203- let config = RuntimeConfig :: new ( ) . with_temp_file_path ( wd. clone ( ) ) ;
204- Ok ( Arc :: new ( RuntimeEnv :: new ( config) ?) )
205- } ) ;
163+ let runtime_producer: RuntimeProducer =
164+ opt. override_runtime_producer . clone ( ) . unwrap_or_else ( || {
165+ Arc :: new ( move |_| {
166+ let config = RuntimeConfig :: new ( ) . with_temp_file_path ( wd. clone ( ) ) ;
167+ Ok ( Arc :: new ( RuntimeEnv :: new ( config) ?) )
168+ } )
169+ } ) ;
206170
207171 let logical = opt
208- . logical_codec
172+ . override_logical_codec
209173 . clone ( )
210174 . unwrap_or_else ( || Arc :: new ( BallistaLogicalExtensionCodec :: default ( ) ) ) ;
211175
212176 let physical = opt
213- . physical_codec
177+ . override_physical_codec
214178 . clone ( )
215179 . unwrap_or_else ( || Arc :: new ( BallistaPhysicalExtensionCodec :: default ( ) ) ) ;
216180
@@ -224,10 +188,10 @@ pub async fn start_executor_process(opt: Arc<ExecutorProcessConfig>) -> Result<(
224188 & work_dir,
225189 runtime_producer,
226190 config_producer,
227- opt. function_registry . clone ( ) . unwrap_or_default ( ) ,
191+ opt. override_function_registry . clone ( ) . unwrap_or_default ( ) ,
228192 metrics_collector,
229193 concurrent_tasks,
230- opt. execution_engine . clone ( ) ,
194+ opt. override_execution_engine . clone ( ) ,
231195 ) ) ;
232196
233197 let connect_timeout = opt. scheduler_connect_timeout_seconds as u64 ;
0 commit comments