手动、部分和生产环境执行(Manual, partial, and production executions)#
在 n8n 手动执行工作流(点击 执行工作流 按钮)和自动执行工作流(当工作流处于 激活 状态并由事件或计划触发)时,存在一些重要的差异。
🌐 There are some important differences in how n8n executes workflows manually (by clicking the Execute Workflow button) and automatically (when the workflow is Active and triggered by an event or schedule).
手动执行(Manual executions)#
手动执行允许你直接从画布运行工作流,以测试你的工作流逻辑。这些执行是“临时的”:只有当你手动选择执行工作流按钮时才会运行。
🌐 Manual executions allow you to run workflows directly from the canvas to test your workflow logic. These executions are "ad-hoc": they run only when you manually select the Execute workflow button.
手动执行通过允许你在构建流程时逐步测试,使工作流构建更容易,你可以按照流程逻辑查看数据的转换。你可以通过提供不同的输入项和修改节点选项来测试条件分支、数据格式更改以及循环行为。
🌐 Manual executions make building workflows easier by allowing you to iteratively test as you go, following the flow logic and seeing data transformations. You can test conditional branching, data formatting changes, and loop behavior by providing different input items and modifying node options.
固定执行数据
在执行手动操作时,你可以使用 数据固定 来“固定”或“冻结”节点的输出数据。你也可以选择 编辑固定的数据。
在后续运行中,n8n 不会执行已固定的节点,而是使用固定的数据并继续按照流程逻辑执行。这使你可以在不操作可变数据或重复向外部服务发出查询的情况下进行迭代。生产环境的执行会忽略所有固定的数据。
部分执行(Partial executions)#
在 编辑器 选项卡中,点击工作流底部的 执行工作流 按钮可以手动运行整个工作流。你也可以执行部分运行以运行工作流中的特定步骤。部分运行是只执行工作流节点子集的手动执行。
🌐 Clicking the Execute workflow button at the bottom of the workflow in the Editor tab manually runs the entire workflow. You can also perform partial executions to run specific steps in your workflow. Partial executions are manual executions that only run a subset of your workflow nodes.
要执行部分操作,请选择一个节点,打开其详细视图,然后选择 执行步骤。这将执行特定节点及执行其输入数据所需的任何前置节点。你还可以在工作流链中暂时禁用特定节点,以在构建过程中避免与这些服务交互。
🌐 To perform a partial execution, select a node, open its detail view, and select Execute step. This executes the specific node and any preceding nodes required to fill in its input data. You can also temporarily disable specific nodes in the workflow chain to avoid interacting with those services while building.
尤其是在更新特定节点的逻辑时,部分执行非常有用,因为它允许你使用相同的输入数据重新执行该节点。
🌐 In particular, partial executions are useful when updating the logic of a specific node since they allow you to re-execute the node with the same input data.
部分执行故障排除(Troubleshooting partial executions)#
运行部分执行时可能会遇到的一些常见问题包括:
🌐 Some common issues you might come across when running partial executions include the following:
The destination node is not connected to any trigger. Partial executions need a trigger.
当你尝试在未将工作流连接到触发器的情况下执行部分运行时,会出现此错误消息。手动执行(包括部分执行)会尽可能模仿生产环境中的执行。其中的一部分要求使用触发节点来描述工作流逻辑应何时执行。
🌐 This error message appears when you try to perform a partial execution without connecting the workflow to a trigger. Manual executions, including partial executions, attempt to mimic production executions when possible. Part of this includes requiring a trigger node to describe when the workflow logic should execute.
为了解决这个问题,可以将一个触发节点连接到工作流中你想要执行的节点。通常,手动触发是最简单的选项。
🌐 To work around this, connect a trigger node to the workflow with the node you're trying to execute. Most often, a manual trigger is the simplest option.
请执行整个工作流,而不仅仅是节点。(现有的执行数据太大。)
当在具有大量分支的工作流上执行部分执行时,可能会出现此错误。部分执行涉及以不需要完整执行的方式将数据和工作流逻辑发送到 n8n 后端。当你的工作流超过这些消息允许的最大大小时,就会发生此错误。
🌐 This error can appear when performing partial executions on workflows with large numbers of branches. Partial executions involve sending data and workflow logic to the n8n backend in a way that isn't required for full executions. This error occurs when your workflow exceeds the maximum size allowed for these messages.
为了解决这个问题,可以考虑使用 limit 节点 来在运行部分执行时限制节点输出。一旦工作流按预期运行,可以在启用生产执行之前禁用或删除 limit 节点。
🌐 To work around this, consider using the limit node to limit node output while running partial executions. Once the workflow is running as intended, you can disable or delete the limit node before enabling production execution.
生产执行(Production executions)#
当触发事件或计划自动运行工作流时,就会发生生产执行。
🌐 Production executions occur when a triggering event or schedule automatically runs a workflow.
要配置生产执行,你必须附加一个触发节点(除手动触发之外的任何触发器均可)并将工作流的切换按钮切换为激活。发布后,每当触发条件发生时,工作流将自动执行。
🌐 To configure production executions, you must attach a trigger node (any trigger other than the manual trigger works) and switch workflow's toggle to Active. Once published, the workflow automatically executes whenever the trigger condition occurs.
生产执行的执行流程不会像手动执行那样显示在工作流的编辑器选项卡中。相反,你可以根据你的工作流设置在工作流的执行选项卡中查看执行情况。在那里,你可以使用编辑器调试功能进行问题排查和分析。
🌐 The execution flow for production executions doesn't display in the Editor tab of the workflow as with manual executions. Instead, you can see executions in the workflow's Executions tab according to your workflow settings. From there, you can explore and troubleshoot problems using the debug in editor feature.