feat: add process manager and execution store types (0007b, 0007c)

Process spawn/wait/kill functions for subprocess management with output
capture, timeout, and process group cleanup. DagRun and DagStepResult
types for SQLite execution persistence.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 13:05:13 +02:00
parent 3136eb862f
commit 741fdcee24
13 changed files with 579 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
---
name: DagRun
lang: go
domain: infra
version: "1.0.0"
algebraic: product
definition: |
type DagRun struct {
ID string
DagName string
DagPath string
Status string
StartedAt time.Time
FinishedAt time.Time
Trigger string
Error string
}
description: "Representa una ejecucion de un workflow DAG. Almacenado en SQLite con estado, timestamps y trigger."
tags: [dag, execution, run, workflow]
uses_types: []
file_path: "functions/infra/dag_run.go"
---
## Notas
Status puede ser: pending, running, success, failed, cancelled.
Trigger puede ser: manual, cron, api.
+29
View File
@@ -0,0 +1,29 @@
---
name: DagStepResult
lang: go
domain: infra
version: "1.0.0"
algebraic: product
definition: |
type DagStepResult struct {
ID string
RunID string
StepName string
Status string
ExitCode int
Stdout string
Stderr string
StartedAt time.Time
FinishedAt time.Time
DurationMs int64
Error string
}
description: "Resultado de la ejecucion de un step individual dentro de un DagRun. Captura exit code, stdout, stderr y duracion."
tags: [dag, execution, step, result]
uses_types: [DagRun_go_infra]
file_path: "functions/infra/dag_run.go"
---
## Notas
Status puede ser: pending, running, success, failed, skipped.
+24
View File
@@ -0,0 +1,24 @@
---
name: process_handle
lang: go
domain: infra
version: "1.0.0"
algebraic: product
definition: |
type ProcessHandle struct {
Cmd *exec.Cmd
Pid int
StartTime time.Time
Dir string
stdout io.ReadCloser
stderr io.ReadCloser
}
description: "Handle de un subproceso en ejecucion. Contiene el comando, PID, tiempo de inicio, directorio de trabajo y los pipes de stdout/stderr (privados, leidos internamente por ProcessWait)."
tags: [process, subprocess, handle, infra, exec]
uses_types: []
file_path: "functions/infra/process_handle.go"
---
## Notas
Tipo producto. Los campos stdout y stderr son privados para evitar lecturas concurrentes externas — ProcessWait los consume internamente. Cmd.SysProcAttr.Setpgid=true garantiza que ProcessKill puede matar el process group completo usando -Pid.
+23
View File
@@ -0,0 +1,23 @@
---
name: process_result
lang: go
domain: infra
version: "1.0.0"
algebraic: product
definition: |
type ProcessResult struct {
ExitCode int
Stdout string
Stderr string
DurationMs int64
Killed bool
}
description: "Resultado de un subproceso completado. Contiene codigo de salida, salida estandar y de error, duracion en milisegundos, y un flag que indica si fue terminado por timeout."
tags: [process, subprocess, result, exit, infra, exec]
uses_types: []
file_path: "functions/infra/process_handle.go"
---
## Notas
Tipo producto — todos los campos siempre presentes. Killed=true indica que ProcessWait agoto el timeout y llamo a ProcessKill; en ese caso ExitCode suele ser -1 o el codigo de SIGKILL segun el OS. DurationMs incluye el tiempo total desde ProcessSpawn hasta que Wait() retorno.