16 , dag_id_(next_dag_id_.fetch_add(1,
std::memory_order_relaxed))
17 , submit_time_(
std::chrono::steady_clock::now())
46 if (cancellation_token_.is_cancelled())
63 catch (
const std::exception& e)
65 set_error_message(e.what());
70 set_error_message(
"Unknown exception");
77 return std::format(
"[dag_job: {} (id={}, state={})]",
auto get_info() const -> dag_job_info
Creates a dag_job_info snapshot.
auto get_state() const -> dag_job_state
Gets the current state of the job.
std::chrono::steady_clock::time_point submit_time_
Time when the job was created.
dag_job(const std::string &name="dag_job")
Constructs a new dag_job with a name.
std::chrono::steady_clock::time_point start_time_
Time when execution started.
job_id dag_id_
Unique identifier for this job in the DAG.
std::vector< job_id > dependencies_
List of job IDs this job depends on.
auto has_result() const -> bool
Checks if the job has a result.
std::optional< std::string > error_message_
Error message if job failed.
std::any result_
Result value for passing between jobs.
auto do_work() -> common::VoidResult override
Executes the job's work function.
std::chrono::steady_clock::time_point end_time_
Time when execution ended.
~dag_job() override
Virtual destructor.
static std::atomic< job_id > next_dag_id_
Static counter for generating unique DAG job IDs.
auto to_string() const -> std::string override
Returns a string representation of the job.
Represents a unit of work (task) to be executed, typically by a job queue.
auto get_name(void) const -> std::string
Retrieves the name of this job.
DAG-aware job with dependency tracking and unique identifiers.
Core threading foundation of the thread system library.
common::VoidResult make_error_result(error_code code, const std::string &message="")
Create a common::VoidResult error from a thread::error_code.
auto dag_job_state_to_string(dag_job_state state) -> std::string
Convert dag_job_state to string representation.
@ cancelled
Cancelled by user or dependency failure.
@ info
Informational messages highlighting progress.
Information about a job in the DAG.
job_id id
Unique job identifier.