예제 #1
0
def test_random_failure_no_retries(failure_engine):

    failure_engine.iter_modes = ["input_error"]
    ret = qcng.compute(failure_engine.get_job(),
                       failure_engine.name,
                       raise_error=False)
    assert ret.error.error_type == "input_error"
    assert "retries" not in ret.input_data["provenance"].keys()

    failure_engine.iter_modes = ["random_error"]
    ret = qcng.compute(failure_engine.get_job(),
                       failure_engine.name,
                       raise_error=False)
    assert ret.error.error_type == "random_error"
    assert "retries" not in ret.input_data["provenance"].keys()
예제 #2
0
def test_random_failure_with_retries(failure_engine):

    failure_engine.iter_modes = [
        "random_error", "random_error", "random_error"
    ]
    ret = qcng.compute(failure_engine.get_job(),
                       failure_engine.name,
                       raise_error=False,
                       local_options={"retries": 2})
    assert ret.input_data["provenance"]["retries"] == 2
    assert ret.error.error_type == "random_error"

    failure_engine.iter_modes = ["random_error", "input_error"]
    ret = qcng.compute(failure_engine.get_job(),
                       failure_engine.name,
                       raise_error=False,
                       local_options={"retries": 4})
    assert ret.input_data["provenance"]["retries"] == 1
    assert ret.error.error_type == "input_error"
예제 #3
0
def test_random_failure_with_success(failure_engine):

    failure_engine.iter_modes = ["random_error", "pass"]
    failure_engine.ncalls = 0
    ret = qcng.compute(failure_engine.get_job(),
                       failure_engine.name,
                       raise_error=False,
                       local_options={"retries": 1})

    assert ret.success, ret.error.error_message
    assert ret.provenance.retries == 1
    assert ret.extras["ncalls"] == 2