Skip to content

[main]: Update chains SDK docs and split definitions into public_types an… #1008

[main]: Update chains SDK docs and split definitions into public_types an…

[main]: Update chains SDK docs and split definitions into public_types an… #1008

GitHub Actions / JUnit Test Report failed Mar 8, 2025 in 0s

32 tests run, 3 passed, 2 skipped, 27 failed.

Annotations

Check failure on line 160 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_python_sys_req_patch[False-3.11]

tenacity.RetryError: RetryError[<Future at 0x7f89260c8460 state=finished returned Response>]
Raw output
binary = False, python_version = '3.11'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_python_sys_0/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f89262abc70>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_python_sys_req_patch(
        binary, python_version, control_model_handle_tag_tuple
    ):
        _, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_python_requirement_added(req: str):
            th.add_python_requirement(req)
            return th.docker_predict([1], tag=tag, binary=binary)
    
        def predict_with_python_requirement_removed(req):
            th.remove_python_requirement(req)
            return th.docker_predict([1], tag=tag, binary=binary)
    
        def predict_with_system_requirement_added(pkg):
            th.add_system_package(pkg)
            return th.docker_predict([1], tag=tag, binary=binary)
    
        def predict_with_system_requirement_removed(pkg):
            th.remove_system_package(pkg)
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:160: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227028090304: attempt #19; slept for 18.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89260c8460 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[True-3.10]

tenacity.RetryError: RetryError[<Future at 0x7f89265226d0 state=finished returned Response>]
Raw output
binary = True, python_version = '3.10'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor0/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f892653a700>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227029399872: attempt #19; slept for 18.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89265226d0 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[True-3.9]

tenacity.RetryError: RetryError[<Future at 0x7f892445ca00 state=finished returned Response>]
Raw output
binary = True, python_version = '3.9'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor1/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f8924451ca0>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140226995758944: attempt #21; slept for 20.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892445ca00 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[True-3.8]

tenacity.RetryError: RetryError[<Future at 0x7f892559ad90 state=finished returned Response>]
Raw output
binary = True, python_version = '3.8'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor2/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f89244557c0>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140226995773152: attempt #20; slept for 19.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892559ad90 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[True-3.11]

tenacity.RetryError: RetryError[<Future at 0x7f892445cd90 state=finished returned Response>]
Raw output
binary = True, python_version = '3.11'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor3/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f89255f1eb0>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140226995753984: attempt #19; slept for 18.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892445cd90 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[False-3.10]

tenacity.RetryError: RetryError[<Future at 0x7f89262adc70 state=finished returned Response>]
Raw output
binary = False, python_version = '3.10'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor4/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f892602deb0>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227056399168: attempt #19; slept for 18.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89262adc70 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[False-3.9]

tenacity.RetryError: RetryError[<Future at 0x7f89255a95e0 state=finished returned Response>]
Raw output
binary = False, python_version = '3.9'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor5/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f89255ae550>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013940272: attempt #20; slept for 19.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89255a95e0 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[False-3.8]

tenacity.RetryError: RetryError[<Future at 0x7f8924451dc0 state=finished returned Response>]
Raw output
binary = False, python_version = '3.8'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor6/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f8927d93f10>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140226995628640: attempt #19; slept for 18.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f8924451dc0 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 209 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_control_truss_patch_ignored_changes[False-3.11]

tenacity.RetryError: RetryError[<Future at 0x7f892558ebe0 state=finished returned Response>]
Raw output
binary = False, python_version = '3.11'
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_control_truss_patch_ignor7/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f8925596e50>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "binary, python_version",
        [
            (binary, python_version)
            for binary in [True, False]
            for python_version in SUPPORTED_PYTHON_VERSIONS
        ],
    )
    def test_control_truss_patch_ignored_changes(
        binary, python_version, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
        th.update_python_version(python_version)
    
        def predict_with_ignored_changes():
            top_pycache_path = custom_model_control / "__pycache__"
            top_pycache_path.mkdir()
            (top_pycache_path / "bla.pyc").touch()
            model_pycache_path = custom_model_control / "model" / "__pycache__"
            model_pycache_path.mkdir()
            (model_pycache_path / "foo.pyc").touch()
            return th.docker_predict([1], tag=tag, binary=binary)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag, binary=binary)

truss/tests/test_control_truss_patching.py:209: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013877920: attempt #19; slept for 18.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892558ebe0 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 230 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_patch_added_model_dir

tenacity.RetryError: RetryError[<Future at 0x7f89253dcf10 state=finished returned Response>]
Raw output
custom_model_control = PosixPath('/tmp/pytest-of-runner/pytest-0/test_patch_added_model_dir0/control_truss')
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_patch_added_model_dir0')
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_patch_added_model_dir0/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f89244428e0>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    def test_patch_added_model_dir(
        custom_model_control, tmp_path, control_model_handle_tag_tuple
    ):
        custom_model_control, th, tag = control_model_handle_tag_tuple
    
        def predict_with_added_model_dir_file():
            code_file_dir = custom_model_control / "model" / "dir"
            code_file_dir.mkdir(parents=True)
            with (code_file_dir / "foo.bar").open("w") as model_code_file:
                model_code_file.write("foobar")
            return th.docker_predict([1], build_dir=tmp_path, tag=tag)
    
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag)

truss/tests/test_control_truss_patching.py:230: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227012094032: attempt #21; slept for 20.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89253dcf10 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 290 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_patch_env_var

tenacity.RetryError: RetryError[<Future at 0x7f89257d60d0 state=finished returned Response>]
Raw output
control_model_handle_tag_tuple = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_patch_env_var0/control_truss'), <truss.truss_handle.truss_handle.TrussHandle object at 0x7f8926571070>, 'test-docker-custom-model-control-tag:0.0.1')

    @pytest.mark.integration
    def test_patch_env_var(control_model_handle_tag_tuple):
        truss_dir, th, tag = control_model_handle_tag_tuple
    
        def predict_with_environment_variables_change():
            th.add_environment_variable("foo", "bar")
            result = th.docker_predict([1], tag=tag)
            assert result == "bar"
            th.add_environment_variable("foo", "bar2")
            result = th.docker_predict([1], tag=tag)
            assert result == "bar2"
            config_path = truss_dir / "config.yaml"
            with config_path.open("w") as file:
                file.write("{}")
    
            assert th._serving_hash() != th.truss_hash_on_serving_container()
            result = th.docker_predict([1], tag=tag)
            assert result == "No foo :("
    
        with ensure_kill_all():
            new_model_code = """
    import os
    class Model:
        def predict(self, model_input):
            print(os.environ.copy())
            return os.environ.get("foo", "No foo :(")
    """
            update_model_code(truss_dir, new_model_code)
>           result = th.docker_predict([1], tag=tag)

truss/tests/test_control_truss_patching.py:290: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227028087568: attempt #20; slept for 19.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89257d60d0 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 304 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_patch_external_package_dirs

tenacity.RetryError: RetryError[<Future at 0x7f89255ef130 state=finished returned Response>]
Raw output
custom_model_with_external_package = PosixPath('/tmp/pytest-of-runner/pytest-0/test_patch_external_package_di0/control_truss')

    @pytest.mark.integration
    def test_patch_external_package_dirs(custom_model_with_external_package):
        th = TrussHandle(custom_model_with_external_package)
        tag = "test-docker-custom-model-control-external-package-tag:0.0.1"
        th.live_reload()
        with ensure_kill_all():
>           th.docker_predict([1], tag=tag)

truss/tests/test_control_truss_patching.py:304: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:10: in wrapper
    return func(gathered_truss_handle, *args[1:], **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227012053936: attempt #20; slept for 19.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89255ef130 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 367 in truss/tests/test_control_truss_patching.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_control_truss_patching.test_predict_with_external_data_change

tenacity.RetryError: RetryError[<Future at 0x7f89255f2610 state=finished returned Response>]
Raw output
custom_model_external_data_access_tuple_fixture = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_predict_with_external_dat0/external_data_access'), 'test')
tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_predict_with_external_dat0')

    @pytest.mark.integration
    def test_predict_with_external_data_change(
        custom_model_external_data_access_tuple_fixture, tmp_path
    ):
        truss_dir, _ = custom_model_external_data_access_tuple_fixture
        th = TrussHandle(truss_dir)
        th.live_reload()
        tag = "test-external-data-access-tag:0.0.1"
        with ensure_kill_all():
>           th.docker_predict([], tag=tag, network="host")

truss/tests/test_control_truss_patching.py:367: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:424: in docker_predict
    resp = TrussHandle._wait_for_predict(model_base_url, request, binary)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:336: in wrapped_f
    return copy(f, *args, **kw)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:475: in __call__
    do = self.iter(retry_state=retry_state)
.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: in iter
    result = action(retry_state)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013880992: attempt #20; slept for 19.0; last result: returned <Response [503]>>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89255f2610 state=finished returned Response>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

Check failure on line 124 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_predict_python_versions[py38-3.8]

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892558f640>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='cafea821d6be', name='nifty_bhabha')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892559adc0 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892559a0a0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892559adc0 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892559a0a0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227013881184: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892558f640>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013881184: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892558f640>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89253e63a0 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

config_python_version = 'py38', inspected_python_version = '3.8'

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "config_python_version, inspected_python_version",
        [("py38", "3.8"), ("py39", "3.9"), ("py310", "3.10"), ("py311", "3.11")],
    )
    def test_predict_python_versions(config_python_version, inspected_python_version):
        model = """
        import sys
        class Model:
            def predict(self, data):
                version = sys.version_info
                return f"{version.major}.{version.minor}"
        """
    
        config = f"python_version: {config_python_version}"
    
        with ensure_kill_all(), _temp_truss(model, config) as tr:
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f892558f0d0>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892558f640>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 124 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_predict_python_versions[py39-3.9]

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89244329d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='3f8b631b99df', name='happy_mclean')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89255f2880 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f89255f2250>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89255f2880 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f89255f2250>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227014241728: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89244329d0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227014241728: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89244329d0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f8924432a30 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

config_python_version = 'py39', inspected_python_version = '3.9'

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "config_python_version, inspected_python_version",
        [("py38", "3.8"), ("py39", "3.9"), ("py310", "3.10"), ("py311", "3.11")],
    )
    def test_predict_python_versions(config_python_version, inspected_python_version):
        model = """
        import sys
        class Model:
            def predict(self, data):
                version = sys.version_info
                return f"{version.major}.{version.minor}"
        """
    
        config = f"python_version: {config_python_version}"
    
        with ensure_kill_all(), _temp_truss(model, config) as tr:
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f8925264280>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89244329d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 124 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_predict_python_versions[py310-3.10]

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89257f8520>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='c2b879f7b0e7', name='competent_gagarin')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892558ed00 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892558e9d0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892558ed00 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892558e9d0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227013831984: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89257f8520>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013831984: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89257f8520>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89257f80a0 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

config_python_version = 'py310', inspected_python_version = '3.10'

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "config_python_version, inspected_python_version",
        [("py38", "3.8"), ("py39", "3.9"), ("py310", "3.10"), ("py311", "3.11")],
    )
    def test_predict_python_versions(config_python_version, inspected_python_version):
        model = """
        import sys
        class Model:
            def predict(self, data):
                version = sys.version_info
                return f"{version.major}.{version.minor}"
        """
    
        config = f"python_version: {config_python_version}"
    
        with ensure_kill_all(), _temp_truss(model, config) as tr:
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f892558ec70>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89257f8520>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 124 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_predict_python_versions[py311-3.11]

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89253e1880>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='697b27a20323', name='loving_meitner')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89255963a0 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f8925596460>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89255963a0 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f8925596460>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227013864464: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89253e1880>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013864464: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89253e1880>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89253e1910 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

config_python_version = 'py311', inspected_python_version = '3.11'

    @pytest.mark.integration
    @pytest.mark.parametrize(
        "config_python_version, inspected_python_version",
        [("py38", "3.8"), ("py39", "3.9"), ("py310", "3.10"), ("py311", "3.11")],
    )
    def test_predict_python_versions(config_python_version, inspected_python_version):
        model = """
        import sys
        class Model:
            def predict(self, data):
                version = sys.version_info
                return f"{version.major}.{version.minor}"
        """
    
        config = f"python_version: {config_python_version}"
    
        with ensure_kill_all(), _temp_truss(model, config) as tr:
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:124: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f89253e1fa0>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89253e1880>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 143 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_model_load_logs

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892510e370>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='ca94b1ebdb46', name='optimistic_neumann')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892545a730 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892545ad30>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892545a730 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892545ad30>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227012569696: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892510e370>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227012569696: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892510e370>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892510e760 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')

    @pytest.mark.integration
    def test_model_load_logs(test_data_path):
        model = """
        from typing import Optional
        import logging
        class Model:
            def load(self):
                logging.info(f"User Load Message")
    
            def predict(self, model_input):
                return self.environment_name
        """
        config = "model_name: init-environment-truss"
        with ensure_kill_all(), _temp_truss(model, config) as tr:
>           container = tr.docker_run(
                local_port=8090, detach=True, wait_for_server_ready=True
            )

truss/tests/test_model_inference.py:143: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f892510ee80>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892510e370>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 222 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_concurrency_truss

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89253a0c40>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='40d872a4c3f7', name='zealous_kapitsa')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892500f190 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892500f040>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892500f190 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892500f040>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227008067520: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89253a0c40>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227008067520: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89253a0c40>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89254dea90 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')

    @pytest.mark.integration
    def test_concurrency_truss(test_data_path):
        # Tests that concurrency limits work correctly
        with ensure_kill_all():
            truss_dir = test_data_path / "test_concurrency_truss"
            tr = TrussHandle(truss_dir)
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:222: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f89253a0d60>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89253a0c40>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 252 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_requirements_file_truss

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89244522e0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = <[NoSuchContainer("The docker command executed was `/usr/bin/docker container inspect ef3fd4dd40e8b71cf5b3f84df76edb25...dd40e8b71cf5b3f84df76edb25e99b3d2e0a50fb2739a480ae1c9142e0\n'\n") raised in repr()] Container object at 0x7f89254cfee0>
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89254cf520 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f89254cfe50>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89254cf520 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f89254cfe50>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227013048832: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89244522e0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013048832: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89244522e0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f8924452d00 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')

    @pytest.mark.integration
    def test_requirements_file_truss(test_data_path):
        with ensure_kill_all():
            truss_dir = test_data_path / "test_requirements_file_truss"
            tr = TrussHandle(truss_dir)
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:252: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f89254a7c70>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89244522e0>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 267 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_requirements_pydantic[1]

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892536e6d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='bac7e73aea6a', name='objective_noether')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892536e370 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892536ef40>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892536e370 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892536ef40>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227011603568: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892536e6d0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227011603568: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892536e6d0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89251c69a0 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')
pydantic_major_version = '1'

    @pytest.mark.integration
    @pytest.mark.parametrize("pydantic_major_version", ["1", "2"])
    def test_requirements_pydantic(test_data_path, pydantic_major_version):
        with ensure_kill_all():
            truss_dir = test_data_path / f"test_pyantic_v{pydantic_major_version}"
            tr = TrussHandle(truss_dir)
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:267: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f892536e760>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892536e6d0>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 267 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_requirements_pydantic[2]

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89251fceb0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='50ce013a0c5d', name='hardcore_agnesi')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892500fdc0 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892500f5b0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f892500fdc0 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f892500f5b0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227008067520: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89251fceb0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227008067520: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89251fceb0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89251fc3a0 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')
pydantic_major_version = '2'

    @pytest.mark.integration
    @pytest.mark.parametrize("pydantic_major_version", ["1", "2"])
    def test_requirements_pydantic(test_data_path, pydantic_major_version):
        with ensure_kill_all():
            truss_dir = test_data_path / f"test_pyantic_v{pydantic_major_version}"
            tr = TrussHandle(truss_dir)
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:267: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f892520da90>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89251fceb0>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 279 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_async_truss

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892501d880>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='ec57340f97b7', name='inspiring_hoover')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f8925121220 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f8925121760>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f8925121220 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f8925121760>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227009189824: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892501d880>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227009189824: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f892501d880>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892501da30 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')

    @pytest.mark.integration
    def test_async_truss(test_data_path):
        with ensure_kill_all():
            truss_dir = test_data_path / "test_async_truss"
            tr = TrussHandle(truss_dir)
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:279: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f892558b580>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f892501d880>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 293 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_async_streaming

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89252917c0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='19db06f96c0a', name='infallible_ramanujan')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89254cff40 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f89254cfeb0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f89254cff40 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f89254cfeb0>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227013046768: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89252917c0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227013046768: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89252917c0>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f892557a220 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')

    @pytest.mark.integration
    def test_async_streaming(test_data_path):
        with ensure_kill_all():
            truss_dir = test_data_path / "test_streaming_async_generator_truss"
            tr = TrussHandle(truss_dir)
>           _ = tr.docker_run(local_port=8090, detach=True, wait_for_server_ready=True)

truss/tests/test_model_inference.py:293: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f89252913d0>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89252917c0>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError

Check failure on line 313 in truss/tests/test_model_inference.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_inference.test_async_streaming_timeout

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89255efb50>: Failed to establish a new connection: [Errno 111] Connection refused'))
Raw output
url = 'http://localhost:8090/v1/models/model'
container = python_on_whales.Container(id='05f7ea39c47a', name='affectionate_ramanujan')
wait_for_server_ready = True, model_server_stop_retry_override = None

    def wait_for_truss(
        url: str,
        container: str,
        wait_for_server_ready: bool = True,
        model_server_stop_retry_override=None,
    ) -> None:
        from python_on_whales.exceptions import NoSuchContainer
    
        try:
            _wait_for_docker_build(container)
            if wait_for_server_ready:
                if model_server_stop_retry_override is not None:
                    _wait_for_model_server(url, stop=model_server_stop_retry_override)
                else:
>                   _wait_for_model_server(url)

truss/truss_handle/truss_handle.py:1093: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

url = 'http://localhost:8090/v1/models/model'
stop = <tenacity.stop.stop_after_delay object at 0x7f8927f41040>

    def _wait_for_model_server(url: str, stop=stop_after_delay(120)) -> Response:  # type: ignore[return]
>       for attempt in Retrying(
            stop=stop,
            wait=wait_fixed(2),
            retry=(
                retry_if_result(lambda response: response.status_code in [502, 503])
                | retry_if_exception_type(exceptions.ConnectionError)
            ),
        ):

truss/truss_handle/truss_handle.py:1066: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f8924fe2190 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f8924fe2160>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>

    def __iter__(self) -> t.Generator[AttemptManager, None, None]:
        self.begin()
    
        retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
        while True:
>           do = self.iter(retry_state=retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:443: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Retrying object at 0x7f8924fe2190 (stop=<tenacity.stop.stop_after_delay object at 0x7f8927f41040>, wait=<tenacity.wai...0x7f8924fe2160>, before=<function before_nothing at 0x7f892cd139d0>, after=<function after_nothing at 0x7f892cd13c10>)>
retry_state = <RetryCallState 140227007881664: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89255efb50>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def iter(self, retry_state: "RetryCallState") -> t.Union[DoAttempt, DoSleep, t.Any]:  # noqa
        self._begin_iter(retry_state)
        result = None
        for action in self.iter_state.actions:
>           result = action(retry_state)

.venv/lib/python3.9/site-packages/tenacity/__init__.py:376: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rs = <RetryCallState 140227007881664: attempt #61; slept for 120.0; last result: failed (ConnectionError HTTPConnectionPool...ion.HTTPConnection object at 0x7f89255efb50>: Failed to establish a new connection: [Errno 111] Connection refused')))>

    def exc_check(rs: "RetryCallState") -> None:
        fut = t.cast(Future, rs.outcome)
        retry_exc = self.retry_error_cls(fut)
        if self.reraise:
            raise retry_exc.reraise()
>       raise retry_exc from fut.exception()
E       tenacity.RetryError: RetryError[<Future at 0x7f89253473d0 state=finished raised ConnectionError>]

.venv/lib/python3.9/site-packages/tenacity/__init__.py:419: RetryError

During handling of the above exception, another exception occurred:

test_data_path = PosixPath('/home/runner/work/truss/truss/truss/tests/test_data')

    @pytest.mark.integration
    def test_async_streaming_timeout(test_data_path):
        with ensure_kill_all():
            truss_dir = test_data_path / "test_streaming_read_timeout"
            tr = TrussHandle(truss_dir)
>           container = tr.docker_run(
                local_port=8090, detach=True, wait_for_server_ready=True
            )

truss/tests/test_model_inference.py:313: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
truss/truss_handle/decorators.py:7: in wrapper
    return func(*args, **kwargs)
truss/truss_handle/truss_handle.py:349: in docker_run
    raise err
truss/truss_handle/truss_handle.py:339: in docker_run
    wait_for_truss(
truss/truss_handle/truss_handle.py:1097: in wait_for_truss
    retry_err.reraise()
.venv/lib/python3.9/site-packages/tenacity/__init__.py:185: in reraise
    raise self.last_attempt.result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:439: in result
    return self.__get_result()
/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/concurrent/futures/_base.py:391: in __get_result
    raise self._exception
truss/truss_handle/truss_handle.py:1075: in _wait_for_model_server
    response = requests.get(url)
.venv/lib/python3.9/site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
.venv/lib/python3.9/site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
.venv/lib/python3.9/site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <requests.adapters.HTTPAdapter object at 0x7f89255ef550>
request = <PreparedRequest [GET]>, stream = False
timeout = Timeout(connect=None, read=None, total=None), verify = True
cert = None, proxies = OrderedDict()

    def send(
        self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None
    ):
        """Sends PreparedRequest object. Returns Response object.
    
        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param stream: (optional) Whether to stream the request content.
        :param timeout: (optional) How long to wait for the server to send
            data before giving up, as a float, or a :ref:`(connect timeout,
            read timeout) <timeouts>` tuple.
        :type timeout: float or tuple or urllib3 Timeout object
        :param verify: (optional) Either a boolean, in which case it controls whether
            we verify the server's TLS certificate, or a string, in which case it
            must be a path to a CA bundle to use
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        :rtype: requests.Response
        """
    
        try:
            conn = self.get_connection_with_tls_context(
                request, verify, proxies=proxies, cert=cert
            )
        except LocationValueError as e:
            raise InvalidURL(e, request=request)
    
        self.cert_verify(conn, request.url, verify, cert)
        url = self.request_url(request, proxies)
        self.add_headers(
            request,
            stream=stream,
            timeout=timeout,
            verify=verify,
            cert=cert,
            proxies=proxies,
        )
    
        chunked = not (request.body is None or "Content-Length" in request.headers)
    
        if isinstance(timeout, tuple):
            try:
                connect, read = timeout
                timeout = TimeoutSauce(connect=connect, read=read)
            except ValueError:
                raise ValueError(
                    f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, "
                    f"or a single float to set both timeouts to the same value."
                )
        elif isinstance(timeout, TimeoutSauce):
            pass
        else:
            timeout = TimeoutSauce(connect=timeout, read=timeout)
    
        try:
            resp = conn.urlopen(
                method=request.method,
                url=url,
                body=request.body,
                headers=request.headers,
                redirect=False,
                assert_same_host=False,
                preload_content=False,
                decode_content=False,
                retries=self.max_retries,
                timeout=timeout,
                chunked=chunked,
            )
    
        except (ProtocolError, OSError) as err:
            raise ConnectionError(err, request=request)
    
        except MaxRetryError as e:
            if isinstance(e.reason, ConnectTimeoutError):
                # TODO: Remove this in 3.0.0: see #2811
                if not isinstance(e.reason, NewConnectionError):
                    raise ConnectTimeout(e, request=request)
    
            if isinstance(e.reason, ResponseError):
                raise RetryError(e, request=request)
    
            if isinstance(e.reason, _ProxyError):
                raise ProxyError(e, request=request)
    
            if isinstance(e.reason, _SSLError):
                # This branch is for urllib3 v1.22 and later.
                raise SSLError(e, request=request)
    
>           raise ConnectionError(e, request=request)
E           requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /v1/models/model (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f89255efb50>: Failed to establish a new connection: [Errno 111] Connection refused'))

.venv/lib/python3.9/site-packages/requests/adapters.py:700: ConnectionError