Skip to content

Commit

Permalink
fix: pod creation (#383)
Browse files Browse the repository at this point in the history
* fix: pod creation

* relax check
  • Loading branch information
bddppq committed May 23, 2024
1 parent 5319912 commit 7737991
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions leptonai/cli/pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,18 @@ def create(
"""
conn = get_connection_or_die()
try:
deployment_spec = types.DeploymentSpec(
name=name,
deployment_user_spec = types.DeploymentUserSpec(
resource_requirement=types.ResourceRequirement.make_resource_requirement(
resource_shape=resource_shape,
),
mounts=types.Mount.make_mounts_from_strings(mount),
envs=types.EnvVar.make_env_vars_from_strings(list(env), list(secret)),
is_pod=True,
)
deployment_spec = types.Deployment(
metadata=types.Metadata(name=name),
spec=deployment_user_spec,
)
except ValueError as e:
console.print(f"Error encountered while processing pod configs:\n[red]{e}[/].")
console.print("Failed to create pod.")
Expand Down
5 changes: 3 additions & 2 deletions leptonai/photon/tests/test_photon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,10 +1283,11 @@ async def async_sleep(self, seconds: int) -> float:
proc, port = photon_run_local_server(path=path)
res = requests.post(f"http://127.0.0.1:{port}/sleep", json={"seconds": 2})
self.assertEqual(res.status_code, 200, res.text)
self.assertGreaterEqual(res.json(), 2)
# sometimes the time measured is not accurate (e.g 1.9999713897705078), so we just roughly check the value here
self.assertGreaterEqual(res.json(), 1.99)
res = requests.post(f"http://127.0.0.1:{port}/async_sleep", json={"seconds": 2})
self.assertEqual(res.status_code, 200, res.text)
self.assertGreaterEqual(res.json(), 2)
self.assertGreaterEqual(res.json(), 1.99)

class TimeoutSleepPhoton(SleepPhoton):
handler_timeout: int = 1
Expand Down

0 comments on commit 7737991

Please sign in to comment.