Skip to content

Commit ca9dc65

Browse files
committed
cleanup request output
1 parent cfc018a commit ca9dc65

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

qa/L0_backend_python/model_control/model_control_test.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import json
3030
import os
31+
import subprocess
3132
import sys
3233

3334
sys.path.append("../../common")
@@ -112,10 +113,8 @@ def _send_load_model_request(self, model_name):
112113

113114
url = f"http://{self._triton_host}:{self._triton_port}/v2/repository/models/{model_name}/load"
114115

115-
# Create a temporary file for the JSON payload
116-
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False) as f:
117-
json.dump(payload, f)
118-
payload_file = f.name
116+
# Convert payload to JSON string
117+
payload_json = json.dumps(payload)
119118

120119
try:
121120
# Use curl to send the request
@@ -129,7 +128,7 @@ def _send_load_model_request(self, model_name):
129128
"-H",
130129
"Content-Type: application/json",
131130
"-d",
132-
f"@{payload_file}",
131+
payload_json,
133132
"--connect-timeout",
134133
"10",
135134
]
@@ -184,12 +183,6 @@ def __init__(self, error_msg):
184183
self.content = self.text.encode()
185184

186185
return ErrorResponse(str(e))
187-
finally:
188-
# Clean up temporary file
189-
try:
190-
os.unlink(payload_file)
191-
except:
192-
pass
193186

194187
def test_invalid_character_model_names(self):
195188
"""Test that model names with invalid characters are properly rejected"""

0 commit comments

Comments
 (0)