Skip to content

polling the filesystem #3110

polling the filesystem

polling the filesystem #3110

GitHub Actions / JUnit Test Report failed Oct 10, 2024 in 0s

380 tests run, 375 passed, 0 skipped, 5 failed.

Annotations

Check failure on line 137 in truss/tests/templates/control/control/test_server.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_server.test_patch_model_code_update_predict_on_long_load_time[asyncio+uvloop]

assert "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." == {'prediction': [1]}
 +  where "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." = <bound method Response.json of <Response [503 Service Unavailable]>>()
 +    where <bound method Response.json of <Response [503 Service Unavailable]>> = <Response [503 Service Unavailable]>.json
Raw output
app = <fastapi.applications.FastAPI object at 0x7f5bcf641490>
client = <httpx.AsyncClient object at 0x7f5bcf596970>

    @pytest.mark.anyio
    async def test_patch_model_code_update_predict_on_long_load_time(app, client):
        mock_model_file_content = """
    class Model:
        def load(self):
            import time
            time.sleep(3)
    
        def predict(self, request):
            return {'prediction': [1]}
    """
        patch = Patch(
            type=PatchType.MODEL_CODE,
            body=ModelCodePatch(
                action=Action.UPDATE,
                path="model.py",
                content=mock_model_file_content,
            ),
        )
        await _verify_apply_patch_success(client, patch)
        resp = await client.post("/v1/models/model:predict", json={})
        resp.status_code == 200
>       assert resp.json() == {"prediction": [1]}
E       assert "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." == {'prediction': [1]}
E        +  where "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." = <bound method Response.json of <Response [503 Service Unavailable]>>()
E        +    where <bound method Response.json of <Response [503 Service Unavailable]>> = <Response [503 Service Unavailable]>.json

truss/tests/templates/control/control/test_server.py:137: AssertionError

Check failure on line 137 in truss/tests/templates/control/control/test_server.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_server.test_patch_model_code_update_predict_on_long_load_time[asyncio]

assert "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." == {'prediction': [1]}
 +  where "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." = <bound method Response.json of <Response [503 Service Unavailable]>>()
 +    where <bound method Response.json of <Response [503 Service Unavailable]>> = <Response [503 Service Unavailable]>.json
Raw output
app = <fastapi.applications.FastAPI object at 0x7f5b80fb89d0>
client = <httpx.AsyncClient object at 0x7f5bcc126310>

    @pytest.mark.anyio
    async def test_patch_model_code_update_predict_on_long_load_time(app, client):
        mock_model_file_content = """
    class Model:
        def load(self):
            import time
            time.sleep(3)
    
        def predict(self, request):
            return {'prediction': [1]}
    """
        patch = Patch(
            type=PatchType.MODEL_CODE,
            body=ModelCodePatch(
                action=Action.UPDATE,
                path="model.py",
                content=mock_model_file_content,
            ),
        )
        await _verify_apply_patch_success(client, patch)
        resp = await client.post("/v1/models/model:predict", json={})
        resp.status_code == 200
>       assert resp.json() == {"prediction": [1]}
E       assert "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." == {'prediction': [1]}
E        +  where "It appears your model has stopped running. This often means'                         ' it crashed and may need a fix to get it running again." = <bound method Response.json of <Response [503 Service Unavailable]>>()
E        +    where <bound method Response.json of <Response [503 Service Unavailable]>> = <Response [503 Service Unavailable]>.json

truss/tests/templates/control/control/test_server.py:137: AssertionError

Check failure on line 297 in truss/tests/templates/server/test_model_wrapper.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_wrapper.test_model_wrapper_load_error_once

common.errors.ModelNotReady: Model with name model is not ready.
Raw output
app_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_model_wrapper_load_error_0/truss_fs/app')

    @pytest.mark.anyio
    async def test_model_wrapper_load_error_once(app_path):
        if "model_wrapper" in sys.modules:
            model_wrapper_module = sys.modules["model_wrapper"]
            importlib.reload(model_wrapper_module)
        else:
            model_wrapper_module = importlib.import_module("model_wrapper")
        model_wrapper_class = getattr(model_wrapper_module, "ModelWrapper")
        config = yaml.safe_load((app_path / "config.yaml").read_text())
        os.chdir(app_path)
        model_wrapper = model_wrapper_class(config, sdk_trace.NoOpTracer())
        model_wrapper.load()
        # Allow load thread to execute
        time.sleep(1)
>       output = await model_wrapper.predict({}, MagicMock(spec=Request))

/home/runner/work/truss/truss/truss/tests/templates/server/test_model_wrapper.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/tmp/pytest-of-runner/pytest-0/test_model_wrapper_load_error_0/truss_fs/app/model_wrapper.py:462: in predict
    descriptor = self.model_descriptor.predict
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <model_wrapper.ModelWrapper object at 0x7f5bcc164be0>

    @property
    def model_descriptor(self) -> ModelDescriptor:
        if self._maybe_model_descriptor:
            return self._maybe_model_descriptor
        else:
>           raise errors.ModelNotReady(self.name)
E           common.errors.ModelNotReady: Model with name model is not ready.

/tmp/pytest-of-runner/pytest-0/test_model_wrapper_load_error_0/truss_fs/app/model_wrapper.py:297: ModelNotReady

Check failure on line 150 in truss/tests/templates/server/test_model_wrapper.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_wrapper.test_trt_llm_truss_predict

common.errors.ModelNotReady: Model with name model is not ready.
Raw output
trt_llm_truss_container_fs = PosixPath('/tmp/pytest-of-runner/pytest-0/test_trt_llm_truss_predict0/truss_fs')
helpers = <truss.tests.conftest.Helpers object at 0x7f5b80497b50>

    @pytest.mark.anyio
    async def test_trt_llm_truss_predict(trt_llm_truss_container_fs, helpers):
        app_path = trt_llm_truss_container_fs / "app"
        packages_path = trt_llm_truss_container_fs / "packages"
        with _clear_model_load_modules(), helpers.sys_paths(
            app_path, packages_path
        ), _change_directory(app_path):
            model_wrapper_module = importlib.import_module("model_wrapper")
            model_wrapper_class = getattr(model_wrapper_module, "ModelWrapper")
            config = yaml.safe_load((app_path / "config.yaml").read_text())
    
            expected_predict_response = "test"
            mock_predict_called = False
    
            async def mock_predict(return_value):
                nonlocal mock_predict_called
                mock_predict_called = True
                return expected_predict_response
    
            mock_engine = Mock(predict=mock_predict)
            mock_extension = Mock()
            mock_extension.load = Mock()
            mock_extension.model_args = Mock(return_value={"engine": mock_engine})
            with patch.object(
                model_wrapper_module, "_init_extension", return_value=mock_extension
            ):
                model_wrapper = model_wrapper_class(config, sdk_trace.NoOpTracer())
                model_wrapper.load()
>               resp = await model_wrapper.predict({}, MagicMock(spec=Request))

/home/runner/work/truss/truss/truss/tests/templates/server/test_model_wrapper.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/tmp/pytest-of-runner/pytest-0/test_trt_llm_truss_predict0/truss_fs/app/model_wrapper.py:462: in predict
    descriptor = self.model_descriptor.predict
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <model_wrapper.ModelWrapper object at 0x7f5bcc00ba00>

    @property
    def model_descriptor(self) -> ModelDescriptor:
        if self._maybe_model_descriptor:
            return self._maybe_model_descriptor
        else:
>           raise errors.ModelNotReady(self.name)
E           common.errors.ModelNotReady: Model with name model is not ready.

/tmp/pytest-of-runner/pytest-0/test_trt_llm_truss_predict0/truss_fs/app/model_wrapper.py:297: ModelNotReady

Check failure on line 187 in truss/tests/templates/server/test_model_wrapper.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_model_wrapper.test_trt_llm_truss_missing_model_py

common.errors.ModelNotReady: Model with name model is not ready.
Raw output
trt_llm_truss_container_fs = PosixPath('/tmp/pytest-of-runner/pytest-0/test_trt_llm_truss_missing_mod0/truss_fs')
helpers = <truss.tests.conftest.Helpers object at 0x7f5bd38f9310>

    @pytest.mark.anyio
    async def test_trt_llm_truss_missing_model_py(trt_llm_truss_container_fs, helpers):
        app_path = trt_llm_truss_container_fs / "app"
        (app_path / "model" / "model.py").unlink()
    
        packages_path = trt_llm_truss_container_fs / "packages"
        with _clear_model_load_modules(), helpers.sys_paths(
            app_path, packages_path
        ), _change_directory(app_path):
            model_wrapper_module = importlib.import_module("model_wrapper")
            model_wrapper_class = getattr(model_wrapper_module, "ModelWrapper")
            config = yaml.safe_load((app_path / "config.yaml").read_text())
    
            expected_predict_response = "test"
            mock_predict_called = False
    
            async def mock_predict(return_value):
                nonlocal mock_predict_called
                mock_predict_called = True
                return expected_predict_response
    
            mock_engine = Mock(predict=mock_predict, spec=["predict"])
            mock_extension = Mock()
            mock_extension.load = Mock()
            mock_extension.model_override = Mock(return_value=mock_engine)
            with patch.object(
                model_wrapper_module, "_init_extension", return_value=mock_extension
            ):
                model_wrapper = model_wrapper_class(config, sdk_trace.NoOpTracer())
                model_wrapper.load()
>               resp = await model_wrapper.predict({}, MagicMock(spec=Request))

/home/runner/work/truss/truss/truss/tests/templates/server/test_model_wrapper.py:187: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/tmp/pytest-of-runner/pytest-0/test_trt_llm_truss_missing_mod0/truss_fs/app/model_wrapper.py:462: in predict
    descriptor = self.model_descriptor.predict
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <model_wrapper.ModelWrapper object at 0x7f5b80feb430>

    @property
    def model_descriptor(self) -> ModelDescriptor:
        if self._maybe_model_descriptor:
            return self._maybe_model_descriptor
        else:
>           raise errors.ModelNotReady(self.name)
E           common.errors.ModelNotReady: Model with name model is not ready.

/tmp/pytest-of-runner/pytest-0/test_trt_llm_truss_missing_mod0/truss_fs/app/model_wrapper.py:297: ModelNotReady