| 544 | } |
| 545 | |
| 546 | StopReason Driver::runInternal( |
| 547 | std::shared_ptr<Driver>& self, |
| 548 | std::shared_ptr<BlockingState>& blockingState, |
| 549 | RowVectorPtr& result) { |
| 550 | const auto now = getCurrentTimeMicro(); |
| 551 | const auto queuedTime = (now - queueTimeStartMicros_) * 1'000; |
| 552 | // Update the next operator's queueTime. |
| 553 | StopReason stop = |
| 554 | closed_ ? StopReason::kTerminate : task()->enter(state_, now); |
| 555 | if (stop != StopReason::kNone) { |
| 556 | if (stop == StopReason::kTerminate) { |
| 557 | // ctx_ still has a reference to the Task. 'this' is not on |
| 558 | // thread from the Task's viewpoint, hence no need to call |
| 559 | // close(). |
| 560 | ctx_->task->setError(std::make_exception_ptr(BoltRuntimeError( |
| 561 | __FILE__, |
| 562 | __LINE__, |
| 563 | __FUNCTION__, |
| 564 | "", |
| 565 | "Cancelled", |
| 566 | error_source::kErrorSourceRuntime, |
| 567 | error_code::kInvalidState, |
| 568 | false))); |
| 569 | } |
| 570 | return stop; |
| 571 | } |
| 572 | |
| 573 | // Update the queued time after entering the Task to ensure the stats have not |
| 574 | // been deleted. |
| 575 | if (curOperatorId_ < operators_.size()) { |
| 576 | operators_[curOperatorId_]->addRuntimeStat( |
| 577 | "queuedWallNanos", |
| 578 | RuntimeCounter(queuedTime, RuntimeCounter::Unit::kNanos)); |
| 579 | } |
| 580 | |
| 581 | CancelGuard guard(task().get(), &state_, [&](StopReason reason) { |
| 582 | // This is run on error or cancel exit. |
| 583 | if (reason == StopReason::kTerminate) { |
| 584 | task()->setError(std::make_exception_ptr(BoltRuntimeError( |
| 585 | __FILE__, |
| 586 | __LINE__, |
| 587 | __FUNCTION__, |
| 588 | "", |
| 589 | "Cancelled", |
| 590 | error_source::kErrorSourceRuntime, |
| 591 | error_code::kInvalidState, |
| 592 | false))); |
| 593 | } |
| 594 | close(); |
| 595 | }); |
| 596 | |
| 597 | try { |
| 598 | // Invoked to initialize the operators once before driver starts execution. |
| 599 | initializeOperators(); |
| 600 | |
| 601 | BOLT_TEST_ADJUST("bytedance::bolt::exec::Driver::runInternal", this); |
| 602 | |
| 603 | const int32_t numOperators = operators_.size(); |
no test coverage detected