workflow-local-dev

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow Local Development

工作流本地开发

Quick Reference

快速参考

Key Commands

关键命令

TaskCommand
Check pods
kubectl get pods --context kind-kind
Restart component
tilt trigger workflow-<service>
View component logs
tilt logs workflow-<service>
任务命令
检查Pod状态
kubectl get pods --context kind-kind
重启组件
tilt trigger workflow-<service>
查看组件日志
tilt logs workflow-<service>

Locally Deployed Components

本地部署的组件

These workflow services are deployed locally as shared dependencies:
workflow-catalog
,
workflow-executions-api
,
workflow-engine-worker
,
workflow-consumer
,
workflow-validator
,
workflows-worker
,
standalone-tasks-worker

以下工作流服务作为共享依赖项本地部署:
workflow-catalog
,
workflow-executions-api
,
workflow-engine-worker
,
workflow-consumer
,
workflow-validator
,
workflows-worker
,
standalone-tasks-worker

Utility Scripts

实用脚本

Execute these scripts for common operations:
执行以下脚本完成常见操作:

Check Pod Status

检查Pod状态

bash
bash .cursor/skills/workflow-local-dev/scripts/check-pods.sh
bash
bash .cursor/skills/workflow-local-dev/scripts/check-pods.sh

Restart a Service

重启服务

bash
bash .cursor/skills/workflow-local-dev/scripts/restart-service.sh <service-name>
bash
bash .cursor/skills/workflow-local-dev/scripts/restart-service.sh <service-name>

Example: bash .cursor/skills/workflow-local-dev/scripts/restart-service.sh catalog

示例: bash .cursor/skills/workflow-local-dev/scripts/restart-service.sh catalog

undefined
undefined

Tail Service Logs

跟踪服务日志

bash
bash .cursor/skills/workflow-local-dev/scripts/tail-logs.sh <service-name>
bash
bash .cursor/skills/workflow-local-dev/scripts/tail-logs.sh <service-name>

Example: bash .cursor/skills/workflow-local-dev/scripts/tail-logs.sh executions-api

示例: bash .cursor/skills/workflow-local-dev/scripts/tail-logs.sh executions-api

undefined
undefined

Query Database

查询数据库

bash
bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "<SQL query>"
bash
bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "<SQL query>"

Example: bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "SELECT * FROM workflow_engine.workflows ORDER BY created_at DESC LIMIT 5"

示例: bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "SELECT * FROM workflow_engine.workflows ORDER BY created_at DESC LIMIT 5"


---

---

Development Workflow

开发流程

Use this flow primarily when containers fail locally or when you need to debug runtime behavior.
  1. Capture current status:
    kubectl get pods --context kind-kind
  2. Rebuild/restart component:
    tilt trigger workflow-<service>
  3. Watch logs or health:
    kubectl logs -f <pod> --context kind-kind
  4. Inspect configuration or data (if needed):
    bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "<SQL query>"

主要在容器本地运行失败或需要调试运行时行为时使用此流程。
  1. 捕获当前状态:
    kubectl get pods --context kind-kind
  2. 重建/重启组件:
    tilt trigger workflow-<service>
  3. 监控日志或健康状态:
    kubectl logs -f <pod> --context kind-kind
  4. 检查配置或数据(如有需要):
    bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "<SQL query>"

Troubleshooting

故障排查

Pod Issues

Pod问题

bash
kubectl get pods --context kind-kind
kubectl describe pod <pod-name> --context kind-kind
kubectl logs -f <pod-name> --context kind-kind
bash
kubectl get pods --context kind-kind
kubectl describe pod <pod-name> --context kind-kind
kubectl logs -f <pod-name> --context kind-kind

Temporal Workflows

Temporal工作流

Open http://localhost:8081 (Temporal UI) and search by workflow ID.
打开 http://localhost:8081 (Temporal UI) 并按工作流ID搜索。

Database State

数据库状态

bash
undefined
bash
undefined

Use the db-query script (runs psql inside the postgres pod)

使用db-query脚本(在postgres Pod内运行psql)

bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "SELECT * FROM workflow_engine.workflows ORDER BY created_at DESC LIMIT 5"
undefined
bash .cursor/skills/workflow-local-dev/scripts/db-query.sh "SELECT * FROM workflow_engine.workflows ORDER BY created_at DESC LIMIT 5"
undefined

Pulsar Messages

Pulsar消息

bash
pulsar-admin topics stats persistent://public/dap/<topic>
pulsar-client consume persistent://public/dap/<topic> -s test-sub -n 10

bash
pulsar-admin topics stats persistent://public/dap/<topic>
pulsar-client consume persistent://public/dap/<topic> -s test-sub -n 10

Using Kubernetes MCP (When Available)

使用Kubernetes MCP(若可用)

If the Kubernetes MCP server is enabled, you can use MCP tools instead of shell commands for a more integrated experience. The MCP defaults to the
kind-kind
context.
如果Kubernetes MCP服务器已启用,您可以使用MCP工具替代Shell命令,获得更集成的体验。MCP默认使用
kind-kind
上下文。

List Pods

列出Pods

Tool: pods_list
Arguments: { "labelSelector": "app=workflow-catalog" }
Or list all pods:
Tool: pods_list
Arguments: {}
工具: pods_list
参数: { "labelSelector": "app=workflow-catalog" }
或列出所有Pods:
工具: pods_list
参数: {}

Get Pod Logs

获取Pod日志

Tool: pods_log
Arguments: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default",
  "tail": 100
}
For previous container logs (after crash):
Tool: pods_log
Arguments: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default",
  "previous": true
}
工具: pods_log
参数: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default",
  "tail": 100
}
对于容器崩溃后的历史日志:
工具: pods_log
参数: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default",
  "previous": true
}

Execute Commands in Pods (e.g., Database Queries)

在Pod中执行命令(例如数据库查询)

Tool: pods_exec
Arguments: {
  "name": "postgres-xxxxx",
  "namespace": "default",
  "command": ["psql", "-U", "postgres", "-d", "temporal", "-c", "SELECT * FROM workflow_engine.workflows ORDER BY created_at DESC LIMIT 5"]
}
工具: pods_exec
参数: {
  "name": "postgres-xxxxx",
  "namespace": "default",
  "command": ["psql", "-U", "postgres", "-d", "temporal", "-c", "SELECT * FROM workflow_engine.workflows ORDER BY created_at DESC LIMIT 5"]
}

Delete Pod (Force Restart)

删除Pod(强制重启)

Tool: pods_delete
Arguments: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default"
}
工具: pods_delete
参数: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default"
}

Get Pod Details

获取Pod详情

Tool: pods_get
Arguments: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default"
}
工具: pods_get
参数: {
  "name": "workflow-catalog-xxxxx",
  "namespace": "default"
}

List Cluster Events (Troubleshooting)

列出集群事件(故障排查)

Tool: events_list
Arguments: { "namespace": "default" }
Note: When using MCP tools, you don't need to specify
context
as it defaults to
kind-kind
. The MCP approach is useful when you want the agent to directly interact with the cluster without spawning shell processes.

工具: events_list
参数: { "namespace": "default" }
注意: 使用MCP工具时,无需指定
context
,因为它默认使用
kind-kind
。当您希望Agent直接与集群交互而无需启动Shell进程时,MCP方法非常有用。

Additional Resources

额外资源

  • For complete service URLs and infrastructure details, see reference.md
  • 完整的服务URL和基础设施详情,请查看 reference.md