diff --git a/leptonai/cli/pod.py b/leptonai/cli/pod.py index 0bb08e1f4..6cfdd9bca 100644 --- a/leptonai/cli/pod.py +++ b/leptonai/cli/pod.py @@ -93,8 +93,7 @@ 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, ), @@ -102,6 +101,10 @@ def create( 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.") diff --git a/leptonai/photon/tests/test_photon.py b/leptonai/photon/tests/test_photon.py index e0e16767a..d3cff8265 100644 --- a/leptonai/photon/tests/test_photon.py +++ b/leptonai/photon/tests/test_photon.py @@ -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