Skip to content

Commit 73a3933

Browse files
authored
Improve Resource Management and Update Dependencies (#24)
* clear connections * tritony==0.0.20
1 parent 58933e2 commit 73a3933

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

.github/workflows/pre-commit_pytest.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,18 @@ jobs:
4242
--shm-size=1g
4343
--user=root
4444
steps:
45-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
46+
- uses: astral-sh/setup-uv@v5
4647
- name: test bash
4748
env:
4849
TRITON_HOST: localhost
4950
TRITON_HTTP: 8000
5051
TRITON_GRPC: 8001
5152
TRITON_RETRIES: 2
5253
TRITON_CLIENT_TIMEOUT: 1
54+
UV_SYSTEM_PYTHON: 1
5355
run: |
5456
tritonserver --model-repo=$GITHUB_WORKSPACE/model_repository &
55-
pip install uv
5657
uv pip install .[tests]
5758
sleep 3
5859

tests/test_model_call.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,3 @@ def test_with_optional(config):
5959
}
6060
)
6161
assert np.isclose(result[0], sample[0] - OPTIONAL_SUB_VALUE, rtol=EPSILON).all()
62-
63-
64-
def test_reload_model_spec(config):
65-
client = get_client(*config, model_name="sample_autobatching")
66-
# force to change max_batch_size
67-
client.default_model_spec.max_batch_size = 4
68-
69-
sample = np.random.rand(8, 100).astype(np.float32)
70-
result = client(sample)
71-
assert np.isclose(result, sample).all()

tritony/tools.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,18 @@ async def async_default_model_spec(self):
318318
await self._async_renew_triton_client(self._triton_client)
319319
return self.model_specs[self.default_model]
320320

321+
async def async_close(self):
322+
await self._triton_client.close()
323+
321324
def __del__(self):
322-
# Not supporting streaming
323-
# if self.flag.protocol is TritonProtocol.grpc and self.flag.streaming and hasattr(self, "triton_client"):
324-
# self.triton_client.stop_stream()
325-
pass
325+
try:
326+
if asyncio.iscoroutinefunction(self._triton_client.close):
327+
if not asyncio.get_event_loop().is_closed():
328+
asyncio.create_task(self._triton_client.close())
329+
else:
330+
self.close()
331+
except Exception:
332+
pass
326333

327334
@retry((InferenceServerException, grpc.RpcError), tries=TRITON_RETRIES, delay=TRITON_LOAD_DELAY, backoff=2)
328335
def _renew_triton_client(

tritony/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.19"
1+
__version__ = "0.0.20"

0 commit comments

Comments
 (0)