Fix bug in terminating a failed pipeline

This commit is contained in:
hesham 2022-03-15 11:28:17 -04:00
parent a7b2ef770e
commit 3d16a4dee2
3 changed files with 8 additions and 5 deletions

View File

@ -58,9 +58,11 @@ Status TreeConsumer::Init(std::shared_ptr<DatasetNode> d) {
} }
Status TreeConsumer::Terminate() { Status TreeConsumer::Terminate() {
CHECK_FAIL_RETURN_UNEXPECTED(tree_adapter_->AllTasks() != nullptr, " Execution tree has not been built"); if (tree_adapter_->AllTasks() != nullptr) {
return tree_adapter_->AllTasks()->ServiceStop(); return tree_adapter_->AllTasks()->ServiceStop();
} }
return Status::OK();
}
#ifndef ENABLE_SECURITY #ifndef ENABLE_SECURITY
Status IteratorConsumer::RegisterProfilingManager() { Status IteratorConsumer::RegisterProfilingManager() {

View File

@ -14,15 +14,16 @@
# ============================================================================ # ============================================================================
""" """
@File : conftest.py @File : conftest.py
@Desc : common fixtures for pytest @Desc : common fixtures for pytest dataset
""" """
import pytest import pytest
from mindspore.dataset.engine.iterators import _cleanup, _unset_iterator_cleanup from mindspore.dataset.engine.iterators import _cleanup, _unset_iterator_cleanup
@pytest.fixture(autouse=True) @pytest.fixture(scope="function", autouse=True)
def close_iterators(): def close_iterators():
yield yield
# Note: code after `yield` is teardown code
_cleanup() _cleanup()
_unset_iterator_cleanup() _unset_iterator_cleanup()

View File

@ -209,7 +209,7 @@ def test_reset_mindrecord(add_and_remove_cv_file): # pylint: disable=unused-arg
run_reset(data, num_epochs=num_epochs, failure_point=failure_point, reset_step=reset_step) run_reset(data, num_epochs=num_epochs, failure_point=failure_point, reset_step=reset_step)
def skip_test_reset_np_error(): def test_reset_np_error():
""" """
Feature: dataset recovery Feature: dataset recovery
Description: Simple test of data pipeline reset feature for error cases (step is negative, or larger than expected) Description: Simple test of data pipeline reset feature for error cases (step is negative, or larger than expected)