|
| 1 | +# Pipeline Operations |
| 2 | + |
| 3 | +Use this skill when diagnosing a deployed Modal pipeline run, especially when a |
| 4 | +GitHub Actions pipeline launch fails or a user asks for the status of a run. |
| 5 | + |
| 6 | +## Source Of Truth |
| 7 | + |
| 8 | +Treat the pipeline status endpoint and run-scoped error records as the first |
| 9 | +diagnostic source. Modal dashboard logs are useful supporting evidence, but they |
| 10 | +are not the durable error record for this repo. |
| 11 | + |
| 12 | +The status system reports: |
| 13 | + |
| 14 | +- the run-level manifest; |
| 15 | +- all stage and substage manifests present for that run; |
| 16 | +- missing expected runtime manifest IDs; |
| 17 | +- the latest durable error record, when one exists; |
| 18 | +- a redacted, bounded traceback when one exists. |
| 19 | + |
| 20 | +## Status Surfaces |
| 21 | + |
| 22 | +The structured status payload is canonical. The pipeline status sub-app exposes |
| 23 | +three Modal functions: |
| 24 | + |
| 25 | +- `get_pipeline_status`: Python-callable structured JSON for agents, scripts, |
| 26 | + dashboards, and tests. Prefer this for diagnosis and automation. |
| 27 | +- `pipeline_status_endpoint`: protected HTTP endpoint returning the same |
| 28 | + structured JSON for non-Python clients. Use Modal proxy auth headers. |
| 29 | +- `pipeline_status_snippet`: human-readable text used by |
| 30 | + `modal run modal_app/pipeline.py::main --action status`. This is for quick |
| 31 | + terminal inspection only and must not be treated as a schema. |
| 32 | + |
| 33 | +## Fetch Status |
| 34 | + |
| 35 | +First identify the run context from the GitHub Actions summary, workflow logs, or |
| 36 | +run-context output: |
| 37 | + |
| 38 | +- `run_id` |
| 39 | +- Modal app name |
| 40 | +- Modal environment |
| 41 | + |
| 42 | +For agent or CLI diagnosis, call the deployed Modal function: |
| 43 | + |
| 44 | +```bash |
| 45 | +uv run python - <<'PY' |
| 46 | +import json |
| 47 | +import modal |
| 48 | +
|
| 49 | +app_name = "POLICYENGINE_US_DATA_MODAL_APP" |
| 50 | +environment_name = "main" |
| 51 | +run_id = "US_DATA_RUN_ID" |
| 52 | +
|
| 53 | +fn = modal.Function.from_name( |
| 54 | + app_name, |
| 55 | + "get_pipeline_status", |
| 56 | + environment_name=environment_name, |
| 57 | +) |
| 58 | +print(json.dumps(fn.remote(run_id), indent=2)) |
| 59 | +PY |
| 60 | +``` |
| 61 | + |
| 62 | +The status payload includes a traceback when one is available. Tracebacks are |
| 63 | +redacted and bounded by keeping the newest text if they are very long. |
| 64 | + |
| 65 | +If the local environment cannot sync the full project environment, use the same |
| 66 | +snippet with a Modal-only temporary environment by replacing `uv run python` |
| 67 | +with `uv run --no-sync --with modal python`. |
| 68 | + |
| 69 | +If using the HTTP endpoint, authenticate with Modal proxy auth headers. Do not |
| 70 | +publish or paste proxy auth values into PRs, issues, logs, or docs. |
| 71 | + |
| 72 | +```bash |
| 73 | +curl \ |
| 74 | + -H "Modal-Key: $MODAL_PROXY_TOKEN_ID" \ |
| 75 | + -H "Modal-Secret: $MODAL_PROXY_TOKEN_SECRET" \ |
| 76 | + "https://<status-endpoint>.modal.run?run_id=<run_id>" |
| 77 | +``` |
| 78 | + |
| 79 | +## Interpret Results |
| 80 | + |
| 81 | +Use `status` and `message` for the short answer. Then inspect: |
| 82 | + |
| 83 | +- `error.stage_id`: canonical top-level stage, such as `3_fit_weights`; |
| 84 | +- `error.substage_id`: narrower substage, such as |
| 85 | + `3a_weight_fitting_regional`; |
| 86 | +- `error.record_path`: immutable error record path in the pipeline volume; |
| 87 | +- `error.latest_path`: latest error pointer for the run; |
| 88 | +- `stage_manifests[].manifest.error`: manifest-local failure details; |
| 89 | +- `missing_expected_manifest_ids`: expected runtime manifests that have not yet |
| 90 | + been written. |
| 91 | + |
| 92 | +When reporting back, name the failing stage and substage, summarize the exception |
| 93 | +type and message, and cite whether the traceback came from the status endpoint or |
| 94 | +from Modal dashboard logs. |
| 95 | + |
| 96 | +## Safety Rules |
| 97 | + |
| 98 | +- Do not paste tracebacks into PRs, issues, or chat unless the user needs that |
| 99 | + detail. |
| 100 | +- Redact secrets before sharing command output, even though the status endpoint |
| 101 | + already applies obvious redaction. |
| 102 | +- Do not infer that a missing later-stage manifest is a failure if the run is |
| 103 | + still running. |
| 104 | +- If the run was hard-killed before Python exception handling ran, the endpoint |
| 105 | + may show a running run with no durable error. In that case, report the last |
| 106 | + completed/running manifest and then use Modal dashboard logs as secondary |
| 107 | + evidence. |
0 commit comments