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,51 @@
|
||||
---
|
||||
name: docker_container_running
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "docker_container_running(name: str, timeout: float = 5.0) -> bool"
|
||||
description: "Comprueba si un contenedor Docker existe y está corriendo. True solo si docker inspect retorna State.Running=true. Cualquier fallo (docker ausente, contenedor inexistente, daemon caído, timeout) devuelve False sin excepción."
|
||||
tags: [docker, container, infra, healthcheck]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [subprocess]
|
||||
params:
|
||||
- name: name
|
||||
desc: "Nombre o ID del contenedor a comprobar. Match exacto, no acepta wildcards."
|
||||
- name: timeout
|
||||
desc: "Timeout en segundos para `docker inspect`. Default 5.0. Si se supera devuelve False."
|
||||
output: "True si el contenedor existe y está corriendo. False en cualquier otro caso (no existe, está parado, docker no disponible, timeout)."
|
||||
tested: true
|
||||
tests:
|
||||
- "True para contenedor en ejecución (mock subprocess)"
|
||||
- "False cuando docker inspect retorna 'false'"
|
||||
- "False cuando el contenedor no existe (returncode != 0)"
|
||||
- "False cuando docker no está instalado (FileNotFoundError)"
|
||||
- "False cuando se excede el timeout (TimeoutExpired)"
|
||||
- "Integration: comprueba contenedor real si docker disponible"
|
||||
test_file_path: "python/functions/infra/tests/test_docker_container_running.py"
|
||||
file_path: "python/functions/infra/docker_container_running.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
from python.functions.infra.docker_container_running import docker_container_running
|
||||
|
||||
if docker_container_running("better_maps_valhalla"):
|
||||
print("Valhalla up")
|
||||
else:
|
||||
print("Valhalla down")
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Wrapper minimalista sobre `docker inspect -f '{{.State.Running}}'`. Pensado como
|
||||
primitiva componible para verificadores de stack y health checks. No lanza
|
||||
excepciones — un fallo de cualquier tipo se reporta como False, dejando que
|
||||
el caller decida qué hacer (skip de test, reintentar, levantar el stack, etc.).
|
||||
Reference in New Issue
Block a user