nf-server CLI — 面向生信工程师和 AI Agent 的命令行工具
Project description
nfctl
nf-server CLI — 面向生信工程师和 AI Agent 的命令行工具。
安装
pip install nfctl
配置
# 设置服务地址(默认 http://localhost:8000)
nfctl config set url http://nf-server:8000
# 或通过环境变量
export NFCTL_URL=http://nf-server:8000
命令
查询
nfctl overview # 系统概览
nfctl list [--status running] [-n 20] # 工作流列表
nfctl list --all # 获取全部工作流(自动翻页)
nfctl list --sort created_at --sort-order asc # 按创建时间升序
nfctl list --pipeline WGS --env prod # 按 Pipeline / 环境过滤
nfctl list --project-sn P2026001 # 按 LIMS 项目编号过滤
nfctl list --data-number D001 # 按数据编号过滤
nfctl list --query sample1 # 按 workflow_id / launch_dir / data_number 搜索
nfctl status <id> # 工作流详情
nfctl progress <id> # 进度(含 process 级别明细)
nfctl tasks <id> [--status failed] # 子任务列表
nfctl tasks <id> --sort duration --sort-order desc # 按耗时排序
nfctl task <id> <task_id> # 子任务详情
nfctl log <id> [--grep ERROR] # 日志查看
nfctl resources <id> # 资源统计
管理
nfctl submit <dir> -p <name> -S P2026001 # 投递工作流(--project-sn 必填)
nfctl submit <dir> -p <name> -S P2026001 --env prod # 指定环境(test/gray/prod)
nfctl submit <dir> -p <name> -S P2026001 --dry-run # 仅验证,不实际投递
nfctl resume <id> # 恢复失败/取消的工作流
nfctl cancel <id> [--reason "原因"] # 整体撤销流程(running/succeeded 均可,会通知 LIMS 作废)
nfctl cancel <id> --scope archive # 仅取消后处理/归档,保留分析结果
nfctl delete <id> # 删除工作流(succeeded 不可删)
其他
nfctl pipeline list # Pipeline 配置
nfctl config set/show # 配置管理
手动 submit 场景
LIMS 本身就是通过 nfctl submit 通道向 nf-server 投递 nextflow 任务的。日常分析任务由 LIMS 自动触发,无需手动操作。以下两种情况需要手动 submit:
- LIMS 未正常触发投递:作为应急补投手段。
- 本地独立流程:不需要同步到 LIMS2 云平台的分析任务。
只有走过 submit 通道的任务(LIMS 自动触发或手动补投均可),nf-server 才会记录这个任务,才能监控状态、查日志、续跑。
用法
| 参数 | 说明 |
|---|---|
-p, --pipeline |
Pipeline 名称(必填) |
-S, --project-sn |
LIMS 项目编号(必填) |
-e, --env |
环境,可选 test / gray / prod;省略则不转发到 LIMS2 云平台,按本地独立流程处理 |
--dry-run |
仅校验参数,不实际投递 |
# 场景 1:LIMS 应急补投(同步到云平台)
nfctl submit /path/to/launch_dir -p WGS -S P2026001 -e prod
# 场景 2:本地独立流程(不同步云平台)
nfctl submit /path/to/launch_dir -p WGS -S P2026001
resume 与 qsub 的衔接
- ✅ 走过 submit → 失败后可
nfctl resume <workflow_id>续跑;手动qsub run.sh接管也能被识别为同一任务。 - ❌ 没走过 submit、直接 qsub → nf-server 无记录,无法 resume,也无法监控,且没有补救路径。
AI Agent 使用
所有命令支持 --format json,输出标准信封格式:
nfctl -f json list
# {"ok": true, "data": {"total": 5, "items": [...]}}
使用 --jq 过滤 JSON 输出:
nfctl --jq '.data.items[].workflow_id' list
nfctl --jq '.data.items[] | select(.status=="failed")' list
安装 Agent Skills:
npx skills add huangzhibo/nfctl
开发
uv sync
uv run nfctl --help
uv run pytest
提交前自动跑 ruff(首次 clone 后执行一次):
uv tool install pre-commit # 或 brew install pre-commit / pipx install pre-commit
pre-commit install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nfctl-0.8.0.tar.gz.
File metadata
- Download URL: nfctl-0.8.0.tar.gz
- Upload date:
- Size: 42.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc73b6ed90fd3a9dd716c566bc00e81d4eb25907df66521a44775e2296516ed0
|
|
| MD5 |
dd05e2b806f43bb04a16ec094a9988b2
|
|
| BLAKE2b-256 |
379caaa05218c5e96b156a7386a4951e2a2e948c90c7551c30a86185338054e6
|
Provenance
The following attestation bundles were made for nfctl-0.8.0.tar.gz:
Publisher:
release-please.yml on huangzhibo/nfctl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nfctl-0.8.0.tar.gz -
Subject digest:
cc73b6ed90fd3a9dd716c566bc00e81d4eb25907df66521a44775e2296516ed0 - Sigstore transparency entry: 1927016874
- Sigstore integration time:
-
Permalink:
huangzhibo/nfctl@0a2392c840ba790b66cb044cdc891722a627aad2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/huangzhibo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@0a2392c840ba790b66cb044cdc891722a627aad2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nfctl-0.8.0-py3-none-any.whl.
File metadata
- Download URL: nfctl-0.8.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
424b342492e29f81d79e8f112475a4dcf851d7782b896f7c50e0f4cb9a5f5ec1
|
|
| MD5 |
4fac270085936acff2abf9e98a144ef0
|
|
| BLAKE2b-256 |
e9233033e5764a115fa27d7502747441069a3c442de264f0d1ae53a8def8ac2d
|
Provenance
The following attestation bundles were made for nfctl-0.8.0-py3-none-any.whl:
Publisher:
release-please.yml on huangzhibo/nfctl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nfctl-0.8.0-py3-none-any.whl -
Subject digest:
424b342492e29f81d79e8f112475a4dcf851d7782b896f7c50e0f4cb9a5f5ec1 - Sigstore transparency entry: 1927017351
- Sigstore integration time:
-
Permalink:
huangzhibo/nfctl@0a2392c840ba790b66cb044cdc891722a627aad2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/huangzhibo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-please.yml@0a2392c840ba790b66cb044cdc891722a627aad2 -
Trigger Event:
push
-
Statement type: