Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::dag_config Struct Reference

Configuration options for the DAG scheduler. More...

#include <dag_config.h>

Collaboration diagram for kcenon::thread::dag_config:
Collaboration graph

Public Attributes

dag_failure_policy failure_policy {dag_failure_policy::fail_fast}
 How to handle job failures.
 
std::size_t max_retries {0}
 Maximum number of retry attempts for failed jobs.
 
std::chrono::milliseconds retry_delay {1000}
 Delay between retry attempts.
 
bool detect_cycles {true}
 Whether to detect and reject cycles.
 
bool execute_in_parallel {true}
 Whether to execute ready jobs in parallel.
 
std::function< void(job_id, dag_job_state, dag_job_state)> state_callback
 Callback for state changes.
 
std::function< void(job_id, const std::string &)> error_callback
 Callback for job errors.
 
std::function< void(job_id)> completion_callback
 Callback for job completion.
 

Detailed Description

Configuration options for the DAG scheduler.

This structure contains all configurable options for DAG execution behavior.

Definition at line 72 of file dag_config.h.

Member Data Documentation

◆ completion_callback

std::function<void(job_id)> kcenon::thread::dag_config::completion_callback

Callback for job completion.

Called whenever a job completes successfully. Parameter is:

  • job_id: The ID of the completed job

Definition at line 140 of file dag_config.h.

◆ detect_cycles

bool kcenon::thread::dag_config::detect_cycles {true}

Whether to detect and reject cycles.

When true, adding a dependency that would create a cycle will fail. When false, cycles are not checked (may cause infinite loops).

Definition at line 105 of file dag_config.h.

105{true};

◆ error_callback

std::function<void(job_id, const std::string&)> kcenon::thread::dag_config::error_callback

Callback for job errors.

Called whenever a job fails. Parameters are:

  • job_id: The ID of the failed job
  • error_message: The error message

Definition at line 132 of file dag_config.h.

◆ execute_in_parallel

bool kcenon::thread::dag_config::execute_in_parallel {true}

Whether to execute ready jobs in parallel.

When true, jobs with all dependencies satisfied will be executed in parallel. When false, jobs are executed one at a time.

Definition at line 113 of file dag_config.h.

113{true};

◆ failure_policy

dag_failure_policy kcenon::thread::dag_config::failure_policy {dag_failure_policy::fail_fast}

How to handle job failures.

  • fail_fast: Cancel all dependent jobs immediately
  • continue_others: Continue unrelated jobs, mark dependents as skipped
  • retry: Retry the failed job up to max_retries times
  • fallback: Execute the job's fallback function if available

Definition at line 82 of file dag_config.h.

@ fail_fast
Cancel all dependents immediately on failure.

Referenced by kcenon::thread::config_builder::with_dag_failure_policy().

◆ max_retries

std::size_t kcenon::thread::dag_config::max_retries {0}

Maximum number of retry attempts for failed jobs.

Only used when failure_policy is dag_failure_policy::retry. Set to 0 to disable retries.

Definition at line 90 of file dag_config.h.

90{0};

Referenced by kcenon::thread::thread_system_config::is_valid(), and kcenon::thread::config_builder::with_dag_retry_params().

◆ retry_delay

std::chrono::milliseconds kcenon::thread::dag_config::retry_delay {1000}

Delay between retry attempts.

Only used when failure_policy is dag_failure_policy::retry.

Definition at line 97 of file dag_config.h.

97{1000};

Referenced by kcenon::thread::config_builder::with_dag_retry_params().

◆ state_callback

std::function<void(job_id, dag_job_state, dag_job_state)> kcenon::thread::dag_config::state_callback

Callback for state changes.

Called whenever a job's state changes. Parameters are:

  • job_id: The ID of the job
  • old_state: The previous state
  • new_state: The new state

Definition at line 123 of file dag_config.h.


The documentation for this struct was generated from the following file: