diff --git a/opm/simulators/flow/EclGenericWriter_impl.hpp b/opm/simulators/flow/EclGenericWriter_impl.hpp index 0315c6a7de7..b033333aad3 100644 --- a/opm/simulators/flow/EclGenericWriter_impl.hpp +++ b/opm/simulators/flow/EclGenericWriter_impl.hpp @@ -598,20 +598,23 @@ doWriteOutput(const int reportStepNum, restartValue.addExtra(flores.name, UnitSystem::measure::rate, flores.values); } } + // make sure that the previous I/O request has been completed + // and the number of incomplete tasklets does not increase between + // time steps + this->taskletRunner_->barrier(); + + // check if there might have been a failure in the TaskletRunner + if (this->taskletRunner_->failure()) { + throw std::runtime_error("Failure in the TaskletRunner while writing output."); + } - // first, create a tasklet to write the data for the current time - // step to disk + // create a tasklet to write the data for the current time step to disk auto eclWriteTasklet = std::make_shared( actionState, isParallel ? this->collectOnIORank_.globalWellTestState() : std::move(localWTestState), summaryState, udqState, *this->eclIO_, reportStepNum, timeStepNum, isSubStep, curTime, std::move(restartValue), doublePrecision); - // then, make sure that the previous I/O request has been completed - // and the number of incomplete tasklets does not increase between - // time steps - this->taskletRunner_->barrier(); - // finally, start a new output writing job this->taskletRunner_->dispatch(std::move(eclWriteTasklet)); }