Richard-Durkee opened a new pull request, #2937:
URL: https://github.com/apache/datafusion-ballista/pull/2937

   # Which issue does this PR close?
   
   Part of #85.
   
   # Rationale for this change
   
   An executor runs many tasks at once and they all write to one log. Only a 
few lines, such as `Received task` and `Finished task`, say which task they 
came from, so when a task fails you can't pick out its lines. This PR runs each 
task inside a `tracing` span, as suggested in #85, so every line logged during 
the task carries its job, stage and task ids.
   
   # What changes are included in this PR?
   
   - The new `task_span` module builds a span named `ballista_task` from a task 
definition. The pull loop and `TaskRunnerPool` run each task in it, and 
`DedicatedExecutor::spawn` carries it over to its runtime. The span is error 
level so it stays on when the log level is `warn`.
   - A span only follows the future it wraps, and a task does most of its work 
in tasks it spawns. `trace_spawned_tasks` uses DataFusion's 
`set_join_set_tracer` so that work spawned through `SpawnedTask` and `JoinSet` 
stays in the span. The executor binary calls it at startup.
   - The shuffle writers now use DataFusion's `JoinSet` in place of tokio's, 
which the tracer can't see. It wraps tokio's, so the behaviour is the same. 
`clippy.toml` now disallows `tokio::task::JoinSet`. The blocking IPC writes now 
use `SpawnedTask::spawn_blocking`, as the shuffle reader already does.
   
   Example: TPC-H Q3 with `RUST_LOG=debug` on the executor.
   
   Before:
   ```
   2026-11-21T22:46:46.049072Z DEBUG     task_runner ThreadId(17) 
ballista_core::execution_plans::shuffle_reader: local shuffle file counts:8, 
remote shuffle file count:0.
   ```
   
   After:
   ```
   2026-11-21T22:55:26.735626Z DEBUG     task_runner ThreadId(22) 
ballista_task{job_id=038G0A9CST000 stage_id=1 stage_attempt=0 task_id=0 
task_attempt=0}: ballista_core::execution_plans::shuffle_reader: local shuffle 
file counts:8, remote shuffle file count:0.
   ```
   
   I ran the TPC-H benchmarks and didn't see a regression.
   
   The tests capture the log output and check for the span on the pull path 
(`execution_loop.rs`), the push path (`executor_server.rs`) and inside the 
shuffle writer's spawned tasks (`execution_engine.rs`). The last one fails if 
the writer goes back to tokio's `JoinSet`. I moved `BlockingEngine` and the 
executor fixture from the `execution_loop.rs` tests into `test_util.rs` so the 
push-path test can share them.
   
   # Are there any user-facing changes?
   
   Executor log lines written during a task now include 
`ballista_task{job_id=... stage_id=... stage_attempt=... task_id=... 
task_attempt=...}:` before the module path. 
`ballista_executor::trace_spawned_tasks` is new public API for embedders that 
install their own subscriber. I added a note on both to the 56.0.0 upgrade 
guide.
   
   A known limitation is that a filter that only names other targets, like 
`RUST_LOG=ballista_core=debug`, filters out the span too. Adding 
`ballista_executor=error` brings it back.
   
   I'd like to add a client-supplied trace id that also reaches the scheduler 
as a follow-up.
   


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