57 default:
return "unknown";
125 std::optional<std::chrono::steady_clock::time_point>
end_time;
207 return std::chrono::duration<double, std::milli>(
wait_time).count();
216 return std::chrono::duration<double, std::milli>(
execution_time).count();
239 std::ostringstream oss;
241 oss <<
" \"job_id\": " <<
job_id <<
",\n";
242 oss <<
" \"job_name\": \"" <<
job_name <<
"\",\n";
244 oss << std::fixed << std::setprecision(3);
245 oss <<
" \"wait_time_ms\": " <<
wait_time_ms() <<
",\n";
247 oss <<
" \"total_latency_ms\": "
248 << std::chrono::duration<double, std::milli>(
total_latency()).count() <<
",\n";
251 std::ostringstream tid_oss;
253 oss <<
" \"thread_id\": \"" << tid_oss.str() <<
"\"";
257 oss <<
",\n \"error_message\": \"" <<
error_message.value() <<
"\"";
261 oss <<
",\n \"error_message\": null";
266 oss <<
",\n \"stack_trace\": \"" <<
stack_trace.value() <<
"\"";
286 std::ostringstream oss;
293 oss << std::fixed << std::setprecision(3);
297 << std::chrono::duration<double, std::milli>(
total_latency()).count() <<
"ms\n";
job_status
Status of a job in the thread pool.
@ failed
Job failed with an error.
@ cancelled
Job was cancelled before completion.
@ timed_out
Job exceeded its timeout limit.
@ running
Job is currently being executed.
@ pending
Job is waiting in the queue.
@ completed
Job completed successfully.
@ failed
Job failed with an error.
@ cancelled
Job was cancelled.
@ completed
Job completed successfully.
auto job_status_to_string(job_status status) -> std::string
Converts job_status to human-readable string.
std::uint64_t job_id
Unique job identifier for DAG scheduler.
Information about a job in the thread pool.
std::chrono::nanoseconds wait_time
Time spent waiting in the queue before execution.
auto to_json() const -> std::string
Converts the job info to a JSON string.
std::thread::id executed_by
ID of the thread that executed/is executing the job.
std::optional< std::chrono::steady_clock::time_point > end_time
Time when the job finished (completed, failed, or cancelled).
auto wait_time_ms() const -> double
Converts wait_time to milliseconds.
auto is_finished() const -> bool
Checks if the job has finished execution.
job_status status
Current status of the job.
std::optional< std::string > stack_trace
Stack trace captured when the job failed.
auto is_active() const -> bool
Checks if the job is still active (pending or running).
std::chrono::nanoseconds execution_time
Time spent executing the job.
std::chrono::steady_clock::time_point start_time
Time when the job started executing.
auto total_latency() const -> std::chrono::nanoseconds
Calculates total latency (wait + execution time).
std::string job_name
Human-readable name or description of the job.
auto to_string() const -> std::string
Converts the job info to a human-readable string.
auto execution_time_ms() const -> double
Converts execution_time to milliseconds.
std::chrono::steady_clock::time_point enqueue_time
Time when the job was added to the queue.
std::optional< std::string > error_message
Error message if the job failed.