feat: cierra issues 0050 y 0052 + commands automáticos
- 0050: jupyter_exec reescrito sin Y.js (REST + KernelClient). Bug raíz adicional: HEAD /api/contents da 405 → cambiado a GET. 9 tests (5 unit + 4 e2e). - 0052: footprint_aurgi cerrado. Bug fix en setup_geo_stack_docker_pipeline (verify aborta si compose up falla; nombre de contenedor incorrecto). - Nueva primitiva docker_container_running_py_infra (7 tests). - /full-git-push y /full-git-pull pasan a modo automático: auto-commit + push sin preguntar, aborta solo si detecta secrets. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""Comprueba si un contenedor Docker está corriendo por nombre."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
|
||||
|
||||
def docker_container_running(name: str, timeout: float = 5.0) -> bool:
|
||||
"""Devuelve True si el contenedor `name` existe y está corriendo.
|
||||
|
||||
Usa `docker inspect -f '{{.State.Running}}' <name>`. Cualquier fallo
|
||||
(docker no instalado, contenedor inexistente, daemon caído, timeout)
|
||||
se interpreta como False.
|
||||
"""
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
["docker", "inspect", "-f", "{{.State.Running}}", name],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=timeout,
|
||||
)
|
||||
except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
|
||||
return False
|
||||
|
||||
if proc.returncode != 0:
|
||||
return False
|
||||
|
||||
return proc.stdout.strip().lower() == "true"
|
||||
Reference in New Issue
Block a user