Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pod creation #383

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading