Lightflow 工作流执行与恢复
run_lightflows
通过 CLI(`lightflow` 或等效的 `python3 -m lightflow`)执行、检查并恢复已有的 Lightflow DAG 工作流。当用户要求运行、试运行、检查状态、可视化、处理 `operator_action` 人工干预检查点(`EXIT_CODE=2`),或恢复失败的 Lightflow 运行而无需编写新工作流时使用。直接运行 `start`,无需预先读取清单或 `actions.py`。
- License 许可
- Apache-2.0
- 所属仓库
- google/lightflow
- 最近更新
- 2026-11-06
- Stars
- ★ 19
- Forks
- 4
01 前言 Front Matter
- name
- run_lightflows
- description
- Executes, inspects, and resumes existing Lightflow DAG workflows via CLI (`lightflow`, or the equivalent `python3 -m lightflow`). Use when asked to run, dry-run, check status, visualize, resolve an `operator_action` human-in-the-loop checkpoint (`EXIT_CODE=2`), or recover a failed Lightflow run without authoring a new workflow. Run `start` directly without pre-reading the manifest or `actions.py`.
02 资源文件 1
- 脚本scripts/send_message.py13.1 KB
03 SKILL.md 正文
Running & Resuming Lightflow Workflows (run_lightflows)
Authoring new workflows? Read
create_lightflowsinstead.
Fast-Path Rules
- Read only
SKILL.md, then runstartdirectly: do not readlightflow.yaml,actions.py, orREADME.mdfirst. The CLI compiles the manifest and prints any gate'sInstructions,Payload Schema, and the exactResume with:command.--lightflow=<path>accepts a manifest file or its directory. - Skip redundant
statuscalls & chain cleanup: whenstartorresumeexits0(Lightflow completed successfully!), do not runstatus. If asked to clean up afterwards, chainstart ... && cleanup ...(&&stops naturally at anEXIT_CODE=2gate).
1. Commands
python3 -m lightflow is equivalent to lightflow when the console script is
not on PATH. Runs remember their manifest, so status, resume, visualize,
and cleanup need only --log_id; if the manifest file moved, pass
--lightflow=<new path> once and it is re-recorded.
lightflow start --lightflow=<dir_or_manifest> --log_id=<run_id> [--payload='{...}' | --payload=@file.json]
lightflow start ... --dry_run # only when asked to preview; ends with a Summary: line and a ? --payload seed hint
# Resolve a paused gate once its Instructions are satisfied (APPROVE sets approved=true itself)
lightflow resume --log_id=<id> --stage=<gate_stage> --resolution=APPROVE --payload='{...}'
lightflow resume --log_id=<id> --stage=<gate_stage> --resolution=REJECT --comment="..." # runs rollback_action; dependents are blocked
# After fixing a failed stage: re-arms only failed stages, keeps completed work
lightflow resume --log_id=<id> [--payload='{...}']
lightflow status --log_id=<id> # one line per stage + any paused gate's Instructions, Schema, resume command; --verbose adds payload + stamp log
lightflow list # every saved run: log ID, lightflow, state, last activity, manifest
lightflow visualize --log_id=<id> --output=/tmp/viz.html
lightflow cleanup --log_id=<id> # deletes the run's state only; workflow artifacts on disk are untouched
2. Exit Codes & Governance
0COMPLETED: done; report the stage outputs printed tostdout.2SUSPENDED at anoperator_action: follow the printedInstructions, thenresumewith a payload matching thePayload Schema.--resolution=APPROVEvalidates--payloadagainst the gate'sjson_schema; on a validation error the gate stays paused, so fix the payload and re-run (statusreprints the schema in a new conversation).1FAILED or REJECTED: the footer names the root cause and the exactresumecommand. Fix the cause, thenresume— neverstart --force, which discards completed stages and is only for rerunning a completed run from scratch. A rejected gate (?) is terminal unless deliberately re-opened:resume --stage=<gate> --resolution=APPROVE --payload='{...}'decides again in one call; a bareresume --stage=<gate>only re-opens it.statusexits like the run:0completed ·1failed, rejected, or interrupted ·2paused ·3no saved state ·4running in another process (wait; don'tresume) ·5waiting: apolling_policystage yielded before its condition was met, nothing is broken,resumeonce it holds. Use--verboseonly when you need the payload, stamp log, or Mermaid diagram.
04 同仓库更多 Skills
Lightflow DAG 工作流构建
create_lightflows
指导使用 Lightflow(YAML 或 JSON)设计、编写、编译和验证新的 Python DAG 工作流。在构建新的多阶段流水线、编写 `actions.py` 和 `lightflow.yaml`,或使用 `create_lightflow` 元工作流搭建工作流骨架时使用。若仅运行或恢复已有工作流,请改用 `run_lightflows`。
Lightflow 基准测试
benchmark_lightflow
运行、验证并扩展 Lightflow 基准测试套件:第一部分,操作员压力下的步骤遵循度(benchmarks/reliability_benchmark.py、工作流 prod_hotfix_rollout、20 个匹配种子、Arm A Lightflow 对比 Arm B 散文式 runbook);第二部分,跨 7 个内置示例工作流的确定性上下文占用测量(benchmarks/context_footprint.py)。