Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-baseten committed Nov 5, 2024
1 parent 5788801 commit 0145dc7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions truss/tests/test_model_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ 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:
with ensure_kill_all(), _temp_truss(model, config) as tr:
# Mimic environment changing to staging
staging_env = {"name": "staging"}
staging_env_str = json.dumps(staging_env)
Expand All @@ -810,7 +810,7 @@ def predict(self, model_input):

# Test a truss deployment with no associated environment
config = "model_name: init-no-environment-truss"
with ensure_kill_all(), temp_truss(model, config) as tr:
with ensure_kill_all(), _temp_truss(model, config) as tr:
container = tr.docker_run(
local_port=8090,
detach=True,
Expand All @@ -836,8 +836,7 @@ def setup_environment(self, environment: Optional[dict]):
def predict(self, model_input):
return model_input
"""
config = "model_name: setup-environment-truss"
with ensure_kill_all(), temp_truss(model, config) as tr:
with ensure_kill_all(), _temp_truss(model, "") as tr:
container = tr.docker_run(
local_port=8090,
detach=True,
Expand Down Expand Up @@ -887,8 +886,7 @@ def load(self):
def predict(self, model_input):
return model_input
"""
config = "model_name: setup-environment-and-load-truss"
with ensure_kill_all(), temp_truss(model, config) as tr:
with ensure_kill_all(), _temp_truss(model, "") as tr:
# Mimic environment changing to staging
staging_env = {"name": "staging"}
staging_env_str = json.dumps(staging_env)
Expand Down Expand Up @@ -934,7 +932,8 @@ def predict(self, model_input):
]
)

def _patch_termination_timeout(container: Container, truss_container_fs):

def _patch_termination_timeout(container: Container, seconds: int, truss_container_fs):
app_path = truss_container_fs / "app"
sys.path.append(str(app_path))
import truss_server
Expand Down

0 comments on commit 0145dc7

Please sign in to comment.