Skip to content

Commit

Permalink
support kube tty
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed Jul 15, 2024
1 parent e72b653 commit 3764262
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pydatatask/executor/container_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ def build_pod_spec(
quota: Quota,
mounts: Dict[str, str],
privileged: bool,
tty: bool,
):
mount_info = {
provided_name: (
Expand Down Expand Up @@ -378,6 +379,8 @@ def build_pod_spec(
for mountpoint, name in mounts.items()
if not mount_info[name][1].null
],
"tty": tty,
"stdin": tty,
}
],
"volumes": [info.to_kube(name) for (name, info) in mount_info.values() if not info.null],
Expand All @@ -397,9 +400,7 @@ async def launch(
privileged: bool,
tty: bool,
):
if tty:
raise ValueError("Cannot do tty from a container on a kube cluster")
podspec = self.build_pod_spec(image, entrypoint, cmd, environ, quota, mounts, privileged)
podspec = self.build_pod_spec(image, entrypoint, cmd, environ, quota, mounts, privileged, tty)
await self.cluster.launch(
task,
job,
Expand Down
4 changes: 1 addition & 3 deletions pydatatask/executor/container_set_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ async def launch(
privileged: bool,
tty: bool,
):
if tty:
raise ValueError("Cannot do tty from a container on a kube cluster")
pod_spec = self.inner.build_pod_spec(image, entrypoint, cmd, environ, quota, mounts, privileged)
pod_spec = self.inner.build_pod_spec(image, entrypoint, cmd, environ, quota, mounts, privileged, tty)
pod_spec["restartPolicy"] = "Always"
nonce = "".join(random.choice(string.ascii_lowercase) for _ in range(8))
pod_template = {
Expand Down

0 comments on commit 3764262

Please sign in to comment.