!31332 Fix bug in terminating a failed pipeline

Merge pull request !31332 from h.farahat/fix_reset
This commit is contained in:
i-robot 2022-03-15 20:17:05 +00:00 committed by Gitee
commit 5f75c701d5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 8 additions and 5 deletions

View File

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

View File

@ -14,15 +14,16 @@
# ============================================================================
"""
@File : conftest.py
@Desc : common fixtures for pytest
@Desc : common fixtures for pytest dataset
"""
import pytest
from mindspore.dataset.engine.iterators import _cleanup, _unset_iterator_cleanup
@pytest.fixture(autouse=True)
@pytest.fixture(scope="function", autouse=True)
def close_iterators():
yield
# Note: code after `yield` is teardown code
_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)
def skip_test_reset_np_error():
def test_reset_np_error():
"""
Feature: dataset recovery
Description: Simple test of data pipeline reset feature for error cases (step is negative, or larger than expected)