You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by mg...@apache.org on 2026/05/08 14:00:18 UTC

(datafusion-ballista) branch main updated: [TUI] Configurable tick interval (#1669)

This is an automated email from the ASF dual-hosted git repository.

martin-g pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-ballista.git


The following commit(s) were added to refs/heads/main by this push:
     new c65b41a9b [TUI] Configurable tick interval (#1669)
c65b41a9b is described below

commit c65b41a9b8c44e3969b64dd021a924d81a32d151
Author: Martin Grigorov <ma...@users.noreply.github.com>
AuthorDate: Fri May 8 17:00:14 2026 +0300

    [TUI] Configurable tick interval (#1669)
    
    * [TUI] Make the update UI interval (tick) configurable
    
    * [TUI] Use dirs::config_local_dir() for Ballista
    
    Rename the config file from `.../ballista/config.yaml` to
    `.../ballista/tui.yaml`
    
    Full paths:
    ```
    |Platform | Example                                  |
    | ------- | ---------------------------------------- |
    | Linux   | /home/alice/.config/ballista/tui.yaml                      |
    | macOS   | /Users/Alice/Library/Application Support/ballista/tui.yaml |
    | Windows | C:\Users\Alice\AppData\Local\ballista\tui.yaml             |
    ```
    
    Override with env vars:
    * BALLISTA_HTTP_TIMEOUT=30000
    * BALLISTA_SCHEDULER_URL=https://example.com:50050
    * BALLISTA_TICK_INTERVAL=1000
    
    * Rename tick_interval to tick_interval_ms
    
    Log the configuration as DEBUG at app start
---
 ballista-cli/src/tui/infrastructure/config.rs | 11 ++++++++---
 ballista-cli/src/tui/mod.rs                   |  3 ++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ballista-cli/src/tui/infrastructure/config.rs b/ballista-cli/src/tui/infrastructure/config.rs
index 5764e554f..323e0e5a3 100644
--- a/ballista-cli/src/tui/infrastructure/config.rs
+++ b/ballista-cli/src/tui/infrastructure/config.rs
@@ -33,9 +33,13 @@ pub struct HttpSettings {
 pub struct Settings {
     pub scheduler: SchedulerSettings,
     pub http: HttpSettings,
+    /// How often to refresh the UI. In millis.
+    pub tick_interval_ms: u64,
 }
 
 const DEFAULT_CONFIG: &str = r#"
+tick_interval_ms: 2000
+
 scheduler:
   url: http://localhost:50050
 
@@ -45,7 +49,7 @@ http:
 
 impl Settings {
     pub(crate) fn new() -> Result<Self, ConfigError> {
-        let config_dir = dirs::config_dir()
+        let config_dir = dirs::config_local_dir()
             .or_else(|| dirs::home_dir().map(|h| h.join(".config")))
             .unwrap_or_else(|| std::path::PathBuf::from(".config"))
             .join("ballista");
@@ -55,13 +59,14 @@ impl Settings {
             .add_source(File::from_str(DEFAULT_CONFIG, FileFormat::Yaml))
             // Add in user's config file
             .add_source(
-                File::with_name(&format!("{}/config", config_dir.display()))
+                File::with_name(&format!("{}/tui", config_dir.display()))
+                    .format(FileFormat::Yaml)
                     .required(false),
             )
             // Add in settings from the environment (with a prefix of BALLISTA_)
             // E.g. `BALLISTA_SCHEDULER_URL=http://localhost:50051 ballista_cli`
             // would set the scheduler url key
-            .add_source(Environment::with_prefix("BALLISTA"))
+            .add_source(Environment::with_prefix("BALLISTA").separator("_"))
             .build()?;
 
         s.try_deserialize()
diff --git a/ballista-cli/src/tui/mod.rs b/ballista-cli/src/tui/mod.rs
index 1f17e50e6..a7c1553fe 100644
--- a/ballista-cli/src/tui/mod.rs
+++ b/ballista-cli/src/tui/mod.rs
@@ -44,10 +44,11 @@ pub async fn tui_main() -> TuiResult<()> {
     tracing::info!("Starting the Ballista TUI application");
 
     let config = Settings::new()?;
+    tracing::debug!("TUI configuration: {:?}", config);
 
     let mut tui_wrapper = TuiWrapper::new()?;
+    let mut events = EventHandler::new(Duration::from_millis(config.tick_interval_ms));
     let mut app = App::new(config)?;
-    let mut events = EventHandler::new(Duration::from_millis(2000));
 
     let (app_tx, mut app_rx) = tokio::sync::mpsc::channel(16);
     app.set_event_tx(app_tx);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org