Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion native-engine/blaze-serde/proto/blaze.proto
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ message ExpandProjection {

// Unique identifier for a materialized partition of data
message PartitionId {
string job_id = 1;
uint32 stage_id = 2;
uint32 partition_id = 4;
uint64 task_id = 5;
}

message TaskDefinition {
Expand Down
4 changes: 3 additions & 1 deletion native-engine/blaze/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use log::{Level, LevelFilter, Log, Metadata, Record};
use once_cell::sync::OnceCell;

thread_local! {
pub static THREAD_TID: Cell<usize> = Cell::new(0);
pub static THREAD_STAGE_ID: Cell<usize> = Cell::new(0);
pub static THREAD_PARTITION_ID: Cell<usize> = Cell::new(0);
}
Expand Down Expand Up @@ -50,8 +51,9 @@ impl Log for SimpleLogger {
let elapsed_sec = elapsed.as_secs_f64();
let stage_id = THREAD_STAGE_ID.get();
let partition_id = THREAD_PARTITION_ID.get();
let tid = THREAD_TID.get();
eprintln!(
"(+{elapsed_sec:.3}s) [{}] (stage: {stage_id}, partition: {partition_id}) - {}",
"(+{elapsed_sec:.3}s) [{}] (stage: {stage_id}, partition: {partition_id}, tid: {tid}) - {}",
record.level(),
record.args()
);
Expand Down
4 changes: 3 additions & 1 deletion native-engine/blaze/src/rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ use tokio::{runtime::Runtime, task::JoinHandle};

use crate::{
handle_unwinded_scope,
logging::{THREAD_PARTITION_ID, THREAD_STAGE_ID},
logging::{THREAD_PARTITION_ID, THREAD_STAGE_ID, THREAD_TID},
metrics::update_spark_metric_node,
};

Expand All @@ -80,6 +80,7 @@ impl NativeExecutionRuntime {
let task_id = &task_definition.task_id.expect("task_id is empty");
let stage_id = task_id.stage_id as usize;
let partition_id = task_id.partition_id as usize;
let tid = task_id.task_id as usize;
let plan = &task_definition.plan.expect("plan is empty");
drop(raw_task_definition);

Expand Down Expand Up @@ -118,6 +119,7 @@ impl NativeExecutionRuntime {
);
THREAD_STAGE_ID.set(stage_id);
THREAD_PARTITION_ID.set(partition_id);
THREAD_TID.set(tid);
});
if num_worker_threads > 0 {
tokio_runtime_builder.worker_threads(num_worker_threads as usize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ case class BlazeCallNativeWrapper(
.newBuilder()
.setPartitionId(partition.index)
.setStageId(context.map(_.stageId()).getOrElse(0))
.setJobId(partition.index.toString)
.setTaskId(context.map(_.taskAttemptId()).getOrElse(0))
.build()

val taskDefinition = TaskDefinition
Expand Down
Loading