The TaskExecutor is a helper class that enables parallel scheduling and execution of tasks.
More...
The TaskExecutor is a helper class that enables parallel scheduling and execution of tasks.
◆ TaskExecutor() [1/2]
330691 : TaskExecutor(TaskScheduler::GetScheduler(context_p)) {
330692 context = context_p;
330693}
◆ TaskExecutor() [2/2]
330688 : scheduler(scheduler), token(scheduler.CreateProducer()), completed_tasks(0), total_tasks(0) {
330689}
◆ ~TaskExecutor()
| duckdb::TaskExecutor::~TaskExecutor |
( |
| ) |
|
◆ PushError()
| void duckdb::TaskExecutor::PushError |
( |
ErrorData | error | ) |
|
Push an error into the TaskExecutor.
330698 {
330699 error_manager.PushError(std::move(error));
330700}
◆ HasError()
| bool duckdb::TaskExecutor::HasError |
( |
| ) |
|
Whether or not any task has encountered an error.
330702 {
330703 return error_manager.HasError();
330704}
◆ ThrowError()
| void duckdb::TaskExecutor::ThrowError |
( |
| ) |
|
Throw an error that was encountered during execution (if HasError() is true).
330706 {
330707 error_manager.ThrowException();
330708}
◆ ScheduleTask()
Schedule a new task.
330710 {
330711 ++total_tasks;
330712 scheduler.ScheduleTask(*token, std::move(task));
330713}
◆ FinishTask()
| void duckdb::TaskExecutor::FinishTask |
( |
| ) |
|
Label a task as finished.
330714 {
330715 ++completed_tasks;
330716}
◆ WorkOnTasks()
| void duckdb::TaskExecutor::WorkOnTasks |
( |
| ) |
|
Work on tasks until all tasks are finished. Throws an exception if any error occurred while executing the tasks.
330718 {
330719
330720 shared_ptr<Task> task_from_producer;
330721 while (scheduler.GetTaskFromProducer(*token, task_from_producer)) {
330722 auto res = task_from_producer->Execute(TaskExecutionMode::PROCESS_ALL);
330723 (void)res;
330724 D_ASSERT(res != TaskExecutionResult::TASK_BLOCKED);
330725 task_from_producer.reset();
330726 }
330727
330728 while (completed_tasks != total_tasks) {
330729 }
330730
330731
330733
330735 }
330736}
bool HasError()
Whether or not any task has encountered an error.
Definition duckdb.cpp:330702
void ThrowError()
Throw an error that was encountered during execution (if HasError() is true).
Definition duckdb.cpp:330706
◆ GetTask()
Get a task - returns true if a task was found.
330738 {
330739 return scheduler.GetTaskFromProducer(*token, task);
330740}
The documentation for this class was generated from the following file: