Check out our new GPU Glossary! Read now

modal.container_process

modal.container_process.ContainerProcess

class ContainerProcess(typing.Generic)
def __init__(
    self,
    process_id: str,
    client: _Client,
    stdout: StreamType = StreamType.PIPE,
    stderr: StreamType = StreamType.PIPE,
    text: bool = True,
    by_line: bool = False,
) -> None:

stdout

@property
def stdout(self) -> _StreamReader[T]:

StreamReader for the container process’s stdout stream.

stderr

@property
def stderr(self) -> _StreamReader[T]:

StreamReader for the container process’s stderr stream.

stdin

@property
def stdin(self) -> _StreamWriter:

StreamWriter for the container process’s stdin stream.

returncode

@property
def returncode(self) -> int:

poll

def poll(self) -> Optional[int]:

Check if the container process has finished running.

Returns None if the process is still running, else returns the exit code.

wait

def wait(self) -> int:

Wait for the container process to finish running. Returns the exit code.

attach

def attach(self, *, pty: Optional[bool] = None):