Skip to content

Commit

Permalink
Improve Resource Management and Update Dependencies (#24)
Browse files Browse the repository at this point in the history
* clear connections

* tritony==0.0.20
  • Loading branch information
kimdwkimdw authored Jan 10, 2025
1 parent 58933e2 commit 73a3933
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/pre-commit_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ jobs:
--shm-size=1g
--user=root
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: test bash
env:
TRITON_HOST: localhost
TRITON_HTTP: 8000
TRITON_GRPC: 8001
TRITON_RETRIES: 2
TRITON_CLIENT_TIMEOUT: 1
UV_SYSTEM_PYTHON: 1
run: |
tritonserver --model-repo=$GITHUB_WORKSPACE/model_repository &
pip install uv
uv pip install .[tests]
sleep 3
Expand Down
10 changes: 0 additions & 10 deletions tests/test_model_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,3 @@ def test_with_optional(config):
}
)
assert np.isclose(result[0], sample[0] - OPTIONAL_SUB_VALUE, rtol=EPSILON).all()


def test_reload_model_spec(config):
client = get_client(*config, model_name="sample_autobatching")
# force to change max_batch_size
client.default_model_spec.max_batch_size = 4

sample = np.random.rand(8, 100).astype(np.float32)
result = client(sample)
assert np.isclose(result, sample).all()
15 changes: 11 additions & 4 deletions tritony/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,18 @@ async def async_default_model_spec(self):
await self._async_renew_triton_client(self._triton_client)
return self.model_specs[self.default_model]

async def async_close(self):
await self._triton_client.close()

def __del__(self):
# Not supporting streaming
# if self.flag.protocol is TritonProtocol.grpc and self.flag.streaming and hasattr(self, "triton_client"):
# self.triton_client.stop_stream()
pass
try:
if asyncio.iscoroutinefunction(self._triton_client.close):
if not asyncio.get_event_loop().is_closed():
asyncio.create_task(self._triton_client.close())
else:
self.close()
except Exception:
pass

@retry((InferenceServerException, grpc.RpcError), tries=TRITON_RETRIES, delay=TRITON_LOAD_DELAY, backoff=2)
def _renew_triton_client(
Expand Down
2 changes: 1 addition & 1 deletion tritony/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.19"
__version__ = "0.0.20"

0 comments on commit 73a3933

Please sign in to comment.