Spaces:
Running
Running
Download src/multi_agent_sdlc/tools/shared/execution.py from pedrorezende/multi-agent-sdlc: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/spaces/pedrorezende/multi-agent-sdlc/resolve/main/src/multi_agent_sdlc/tools/shared/execution.py
- Command line
-
hf download hf://spaces/pedrorezende/multi-agent-sdlc/src/multi_agent_sdlc/tools/shared/execution.py
-
curl -L -o execution.py https://huggingface.co/spaces/pedrorezende/multi-agent-sdlc/resolve/main/src/multi_agent_sdlc/tools/shared/execution.py
1.6 kB
| from langchain.tools import ToolRuntime, tool | |
| from multi_agent_sdlc.system.process import execute_process | |
| from multi_agent_sdlc.tools.shared.description import RUN_DOCKER_COMPOSE_DESCRIPTION | |
| from multi_agent_sdlc.tools.shared.models import ( | |
| DockerComposeOperation, | |
| ExecutionTimeout, | |
| ProcessResult, | |
| ) | |
| from multi_agent_sdlc.workflow.state import DevState | |
| def run_docker_compose( | |
| operation: DockerComposeOperation, | |
| runtime: ToolRuntime[DevState], | |
| remove_volumes: bool = False, | |
| timeout_seconds: ExecutionTimeout = 120, | |
| ) -> ProcessResult: | |
| project_directory = runtime.state["project_directory"] | |
| command = ["docker", "compose"] | |
| match operation: | |
| case DockerComposeOperation.UP: | |
| command.extend( | |
| [ | |
| "up", | |
| "-d", | |
| "--build", | |
| "--wait", | |
| "--wait-timeout", | |
| "60", | |
| ] | |
| ) | |
| case DockerComposeOperation.DOWN: | |
| command.append("down") | |
| if remove_volumes: | |
| command.append("-v") | |
| case DockerComposeOperation.BUILD: | |
| command.append("build") | |
| case DockerComposeOperation.CONFIG: | |
| command.extend(["config", "--quiet"]) | |
| case DockerComposeOperation.PS: | |
| command.append("ps") | |
| return execute_process( | |
| command, | |
| project_directory=project_directory, | |
| timeout_seconds=timeout_seconds, | |
| ) | |