chore: initial commit del deploy de utilerias-recon-2
Incluye: - app.ipynb con las 10 pestanas (Conexion, Descargas, Analisis, NLP, KGS, CTM, Saldos Vencidos, DataStage, Estructuras SCAII, Valores). - launcher.py + run_dev.bat para lanzar Voila localmente. - docker-compose.yml para levantar Postgres 16 con healthcheck. - schema_registro.sql con las 27 tablas (Registro501..Registro701, RegistroInci/Resumen/Sel, base_numpartes). - requirements.txt con pandas, pyodbc, psycopg2-binary, sqlalchemy, scikit-learn, openpyxl, voila, ipywidgets, python-docx. - 6 manuales de usuario (CTM, SaldosVencidos, DataStage, EstructurasSCAII, Valores, GENPACT_V2 general) en .docx. - 6 generadores de manuales para regenerar los .docx tras editar. - .gitignore que excluye .env, .venv, outputs generados y caches. - README.md con instrucciones de setup en server. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
97
app/run_dev.bat
Normal file
97
app/run_dev.bat
Normal file
@@ -0,0 +1,97 @@
|
||||
@echo off
|
||||
REM Ejecuta la app en modo desarrollo (sin empaquetar)
|
||||
REM Requiere Python instalado
|
||||
|
||||
cd /d "%~dp0"
|
||||
echo Directorio: %CD%
|
||||
echo.
|
||||
|
||||
REM Verificar Python
|
||||
where python >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Python no esta en PATH.
|
||||
echo Instala Python 3.11+ y marca "Add Python to PATH" durante la instalacion.
|
||||
goto :end
|
||||
)
|
||||
python --version
|
||||
|
||||
if not exist .venv goto :crear_venv
|
||||
call .venv\Scripts\activate.bat
|
||||
goto :sync_deps
|
||||
|
||||
:crear_venv
|
||||
echo.
|
||||
echo Creando venv local, puede tardar 2-3 minutos...
|
||||
python -m venv .venv
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] No se pudo crear el venv.
|
||||
goto :end
|
||||
)
|
||||
call .venv\Scripts\activate.bat
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
:sync_deps
|
||||
REM Reinstala requirements solo si requirements.txt es mas nuevo que el marcador
|
||||
if not exist .venv\.deps_synced goto :do_install
|
||||
for /f %%i in ('dir /b /od requirements.txt .venv\.deps_synced 2^>nul') do set _newer=%%i
|
||||
if /i "%_newer%"==".deps_synced" goto :run_app
|
||||
:do_install
|
||||
echo.
|
||||
echo [INFO] Sincronizando dependencias (requirements.txt)...
|
||||
python -m pip install -r requirements.txt
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] Fallo la instalacion de dependencias.
|
||||
goto :end
|
||||
)
|
||||
echo. > .venv\.deps_synced
|
||||
|
||||
:run_app
|
||||
|
||||
REM ===== Postgres en Docker (DataStage) =====
|
||||
where docker >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [INFO] Docker no esta instalado. La pestaña DataStage no funcionara.
|
||||
echo Instala Docker Desktop si vas a usarla.
|
||||
goto :launch_voila
|
||||
)
|
||||
|
||||
docker ps --format "{{.Names}}" | findstr /B /C:"postgres-datastage" >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
echo [INFO] Contenedor postgres-datastage ya esta corriendo.
|
||||
goto :launch_voila
|
||||
)
|
||||
|
||||
echo [INFO] Levantando contenedor postgres-datastage...
|
||||
docker compose up -d postgres-datastage
|
||||
if errorlevel 1 (
|
||||
echo [WARN] No se pudo levantar Postgres. La pestaña DataStage no funcionara.
|
||||
goto :launch_voila
|
||||
)
|
||||
echo [INFO] Esperando a que Postgres acepte conexiones...
|
||||
docker compose exec -T postgres-datastage pg_isready >nul 2>nul
|
||||
set /a _retries=0
|
||||
:wait_pg
|
||||
set /a _retries+=1
|
||||
if %_retries% GTR 20 (
|
||||
echo [WARN] Postgres tardo en levantar. Continuamos de todos modos.
|
||||
goto :launch_voila
|
||||
)
|
||||
docker compose exec -T postgres-datastage pg_isready >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
timeout /t 1 /nobreak >nul
|
||||
goto :wait_pg
|
||||
)
|
||||
echo [INFO] Postgres listo.
|
||||
|
||||
:launch_voila
|
||||
echo.
|
||||
echo Lanzando la app...
|
||||
echo (Si el browser no abre, ve a http://127.0.0.1:8866/)
|
||||
echo.
|
||||
python launcher.py
|
||||
|
||||
:end
|
||||
echo.
|
||||
echo ============================================================
|
||||
echo Presiona cualquier tecla para cerrar...
|
||||
pause >nul
|
||||
Reference in New Issue
Block a user