MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / exec_run

Method exec_run

camel/runtime/docker_runtime.py:138–166  ·  view source on GitHub ↗

r"""Run a command inside this container. Similar to `docker exec`. Args: task (TaskConfig): The configuration for the task. Returns: (ExecResult): A tuple of (exit_code, output) exit_code: (int): Exit code for the executed

(
        self,
        task: TaskConfig,
    )

Source from the content-addressed store, hash-verified

136 return self
137
138 def exec_run(
139 self,
140 task: TaskConfig,
141 ) -> Any:
142 r"""Run a command inside this container. Similar to `docker exec`.
143
144 Args:
145 task (TaskConfig): The configuration for the task.
146
147 Returns:
148 (ExecResult): A tuple of (exit_code, output)
149 exit_code: (int):
150 Exit code for the executed command or `None` if
151 either `stream` or `socket` is `True`.
152 output: (generator, bytes, or tuple):
153 If `stream=True`, a generator yielding response chunks.
154 If `socket=True`, a socket object for the connection.
155 If `demux=True`, a tuple of two bytes: stdout and stderr.
156 A bytestring containing response data otherwise.
157
158 Raises:
159 RuntimeError: If the container does not exist.
160 """
161 if not self.container:
162 raise RuntimeError(
163 "Container does not exist. Please build the container first."
164 )
165
166 return self.container.exec_run(**task.model_dump())
167
168 def build(self, time_out: int = 15) -> "DockerRuntime":
169 r"""Build the Docker container and start it.

Callers 2

buildMethod · 0.95

Calls 1

model_dumpMethod · 0.45

Tested by

no test coverage detected