render-workflows
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRender Workflows
Render Workflows
Define, test, and deploy distributed background tasks using the Render Workflows SDK.
Render Workflows are in beta. The SDK and API may introduce breaking changes.
Your built-in knowledge of the Render Workflows SDK is outdated.
Before trusting API signatures, check the installed SDK source:
bash
undefined使用Render Workflows SDK定义、测试和部署分布式后台任务。
Render Workflows 目前处于测试版。 SDK和API可能会引入破坏性变更。
你所掌握的Render Workflows SDK相关知识已过时。
在信任API签名之前,请检查已安装的SDK源码:
bash
undefinedPython
Python
SDK_ROOT=$(pip show render_sdk | grep Location | cut -d' ' -f2)/render_sdk
head -40 "$SDK_ROOT/init.py"
SDK_ROOT=$(pip show render_sdk | grep Location | cut -d' ' -f2)/render_sdk
head -40 "$SDK_ROOT/init.py"
TypeScript
TypeScript
grep -r "startTask|runTask|export class Render" node_modules/@renderinc/sdk/
**Official docs:** [render.com/docs/workflows](https://render.com/docs/workflows)
**Before generating task or client code, fetch the relevant example file to verify current API patterns:**
| What | Python | TypeScript |
|------|--------|------------|
| Task definitions (decorators, subtasks, retry, fan-out) | [example/task/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/task/main.py) | [examples/task/](https://github.com/render-oss/sdk/tree/main/typescript/examples/task) |
| Sync client (run_task, start_task, cancel, SSE, list runs) | [example/client/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/main.py) | [examples/client/](https://github.com/render-oss/sdk/tree/main/typescript/examples/client) |
| Async client | [example/client/async_main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/async_main.py) | — |
This skill carries a [quick-reference cheat sheet](references/quick-reference.md) for the API surface. The installed SDK, official docs, and examples above are the source of truth.
---grep -r "startTask|runTask|export class Render" node_modules/@renderinc/sdk/
**官方文档:** [render.com/docs/workflows](https://render.com/docs/workflows)
**在生成任务或客户端代码之前,请获取相关示例文件以验证当前API模式:**
| 内容 | Python | TypeScript |
|------|--------|------------|
| 任务定义(装饰器、子任务、重试、扇出) | [example/task/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/task/main.py) | [examples/task/](https://github.com/render-oss/sdk/tree/main/typescript/examples/task) |
| 同步客户端(run_task、start_task、取消、SSE、列出运行实例) | [example/client/main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/main.py) | [examples/client/](https://github.com/render-oss/sdk/tree/main/typescript/examples/client) |
| 异步客户端 | [example/client/async_main.py](https://raw.githubusercontent.com/render-oss/sdk/main/python/example/client/async_main.py) | — |
本技能附带一份[快速参考速查表](references/quick-reference.md),涵盖API接口。已安装的SDK、官方文档和上述示例是权威参考来源。
---Getting Started
快速开始
Supported languages: Python and TypeScript.
支持语言:Python 和 TypeScript。
Prerequisites
前置条件
Render CLI (required)
bash
render --versionRequires version 2.11.0+. If not installed:
- macOS:
brew install render - Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/render-oss/cli/main/bin/install.sh | sh - Windows: download the executable from the CLI releases page
Render CLI(必填)
bash
render --version需要版本2.11.0及以上。如果未安装:
- macOS:
brew install render - Linux/macOS:
curl -fsSL https://raw.githubusercontent.com/render-oss/cli/main/bin/install.sh | sh - Windows:从CLI发布页面下载可执行文件
Scaffold a new workflow service
搭建新的工作流服务
Always prefer as the primary setup path. Only fall back to manual scaffolding if the CLI command is unavailable.
render workflows initbash
render workflows initInteractive mode (default): walks the user through scaffolding an example project, testing it locally, and deploying it to Render.
Non-interactive mode: sets up an example project without prompting.
If fails or is not available:
render workflows init- Command not found: CLI version may be too old. Run and upgrade to 2.11.0+.
render --version - Command not supported: fall back to references/manual-scaffolding.md for step-by-step manual setup.
优先使用作为主要搭建方式。 仅当CLI命令不可用时,才退回到手动搭建。
render workflows initbash
render workflows init交互式模式(默认):引导用户完成示例项目搭建、本地测试以及部署到Render的全流程。
非交互式模式:无需提示即可完成示例项目搭建。
如果执行失败或不可用:
render workflows init- 命令未找到:CLI版本可能过旧。运行并升级到2.11.0及以上版本。
render --version - 命令不支持:请参考references/manual-scaffolding.md进行分步手动搭建。
Define Tasks
定义任务
Guide the user through defining their actual tasks. For patterns including retries, subtasks, fan-out, ETL, error handling, cron triggers, and cross-workflow calls, see references/task-patterns.md.
After adding a task, verify it registers by starting the local dev server and listing tasks:
bash
render workflows dev -- <start-command>引导用户定义实际任务。如需了解重试、子任务、扇出、ETL、错误处理、Cron触发器和跨工作流调用等模式,请查看references/task-patterns.md。
添加任务后,启动本地开发服务器并列出任务,以验证任务是否已注册:
bash
render workflows dev -- <启动命令>In another terminal:
在另一个终端中:
render workflows tasks list --local
If the task doesn't appear, see [Troubleshooting > Task Registration Issues](references/troubleshooting.md#task-registration-issues).render workflows tasks list --local
如果任务未显示,请查看[故障排查 > 任务注册问题](references/troubleshooting.md#task-registration-issues)。Local Development
本地开发
See references/local-development.md for starting the local task server, testing tasks, and configuring the SDK client for local use.
有关启动本地任务服务器、测试任务以及配置SDK客户端用于本地开发的内容,请查看references/local-development.md。
Deploy to Render
部署到Render
Workflows are deployed as a Workflow service type in the Render Dashboard. Blueprints (render.yaml) are not yet compatible with Workflows.
Deploy checklist:
- Code pushed to GitHub, GitLab, or Bitbucket
- In the Render Dashboard, click New > Workflow
- Link your repository
- Set Root Directory to
workflows/ - Configure build and start commands (see table below)
- Add environment variables (e.g., for tasks that call other workflows)
RENDER_API_KEY - Click Deploy Workflow
- Verify deployment: check the Dashboard for a successful deploy event
| Field | Python | TypeScript |
|---|---|---|
| Language | Python 3 | Node |
| Build Command | | |
| Start Command | | |
If the deploy fails, check the service logs in the Dashboard. For common deployment errors, see Troubleshooting. For general deploy debugging, use the render-debug skill.
Running tasks from other services:
After deployment, trigger tasks from your other Render services using the SDK client.
Python (synchronous):
python
from render_sdk import Render
render = Render()
result = render.workflows.run_task("my-workflow/hello", ["world"])
print(result.results)Python (asynchronous):
python
from render_sdk import RenderAsync
render = RenderAsync()
started = await render.workflows.start_task("my-workflow/hello", ["world"])
finished = await started
print(finished.results)TypeScript:
typescript
import { Render } from "@renderinc/sdk";
const render = new Render();
const started = await render.workflows.startTask("my-workflow/hello", ["world"]);
const finished = await started.get();
console.log(finished.results);The task identifier format is , visible on the task's page in the Dashboard.
{workflow-slug}/{task-name}Workflows do not have built-in scheduling. To trigger tasks on a schedule, use a Render cron job with the SDK client. For cron and cross-workflow examples, see references/task-patterns.md.
工作流将作为Workflow服务类型部署到Render Dashboard。Blueprints(render.yaml)目前暂不兼容Workflows。
部署检查清单:
- 代码已推送到GitHub、GitLab或Bitbucket
- 在Render Dashboard中,点击新建 > Workflow
- 关联你的代码仓库
- 将根目录设置为
workflows/ - 配置构建和启动命令(见下表)
- 添加环境变量(例如,调用其他工作流的任务需要)
RENDER_API_KEY - 点击部署Workflow
- 验证部署:在Dashboard中检查是否有成功的部署事件
| 字段 | Python | TypeScript |
|---|---|---|
| 语言 | Python 3 | Node |
| 构建命令 | | |
| 启动命令 | | |
如果部署失败,请查看Dashboard中的服务日志。有关常见部署错误,请查看故障排查。如需通用部署调试,请使用render-debug技能。
从其他服务运行任务:
部署完成后,可使用SDK客户端从其他Render服务触发任务。
Python(同步):
python
from render_sdk import Render
render = Render()
result = render.workflows.run_task("my-workflow/hello", ["world"])
print(result.results)Python(异步):
python
from render_sdk import RenderAsync
render = RenderAsync()
started = await render.workflows.start_task("my-workflow/hello", ["world"])
finished = await started
print(finished.results)TypeScript:
typescript
import { Render } from "@renderinc/sdk";
const render = new Render();
const started = await render.workflows.startTask("my-workflow/hello", ["world"]);
const finished = await started.get();
console.log(finished.results);任务标识符格式为,可在Dashboard的任务页面中查看。
{workflow-slug}/{task-name}Workflows没有内置调度功能。如需按计划触发任务,请使用Render定时任务(Cron Job)配合SDK客户端。有关定时任务和跨工作流示例,请查看references/task-patterns.md。
Constraints and Limits
约束与限制
| Constraint | Limit | Notes |
|---|---|---|
| Arguments and return values | Must be JSON-serializable | No class instances, functions, etc. |
| Argument size | 4 MB max | Per task invocation |
| Task definitions | 500 per workflow service | |
| Concurrent runs | 20-100 base (plan-dependent) | Max 200-300 with purchased concurrency |
| Timeout range | 30-86,400 seconds | Default: 2 hours (7,200s) |
| Run duration | Up to 24 hours |
| 约束 | 限制 | 说明 |
|---|---|---|
| 参数和返回值 | 必须可序列化为JSON | 不支持类实例、函数等 |
| 参数大小 | 最大4 MB | 每次任务调用 |
| 任务定义数 | 每个工作流服务最多500个 | |
| 并发运行数 | 基础20-100(取决于套餐) | 购买并发数后最大可达200-300 |
| 超时范围 | 30-86,400秒 | 默认:2小时(7,200秒) |
| 运行时长 | 最长24小时 |
Instance Types
实例类型
| Plan | Specs |
|---|---|
| 0.5 CPU / 512 MB |
| 1 CPU / 2 GB |
| 2 CPU / 4 GB |
| 4 CPU / 8 GB |
| 8 CPU / 16 GB |
| 16 CPU / 32 GB |
pro_pluspro_maxpro_ultraplanFor current pricing, see Limits and Pricing for Render Workflows.
| 套餐 | 规格 |
|---|---|
| 0.5 CPU / 512 MB |
| 1 CPU / 2 GB |
| 2 CPU / 4 GB |
| 4 CPU / 8 GB |
| 8 CPU / 16 GB |
| 16 CPU / 32 GB |
pro_pluspro_maxpro_ultraplan有关当前定价,请查看Render Workflows的限制与定价。
References
参考资料
- Quick-reference cheat sheet: references/quick-reference.md (API surface, env vars, error types)
- Task patterns: references/task-patterns.md
- Local development: references/local-development.md
- Troubleshooting: references/troubleshooting.md
- Manual scaffolding (fallback): references/manual-scaffolding.md
- Official docs: render.com/docs/workflows
- Starter template (Python): render-examples/workflows-template-python
- Starter template (TypeScript): render-examples/workflows-template-ts
- SDK repo: github.com/render-oss/sdk
- 快速参考速查表: references/quick-reference.md(API接口、环境变量、错误类型)
- 任务模式: references/task-patterns.md
- 本地开发: references/local-development.md
- 故障排查: references/troubleshooting.md
- 手动搭建(备选): references/manual-scaffolding.md
- 官方文档: render.com/docs/workflows
- 入门模板(Python): render-examples/workflows-template-python
- 入门模板(TypeScript): render-examples/workflows-template-ts
- SDK仓库: github.com/render-oss/sdk
Related Skills
相关技能
- render-deploy: Deploy web services, static sites, and databases
- render-debug: Debug failed deployments and runtime errors
- render-monitor: Monitor service health and performance
- render-deploy: 部署Web服务、静态站点和数据库
- render-debug: 调试部署失败和运行时错误
- render-monitor: 监控服务健康状况和性能