如何执行 X 次 Job Executor 步骤

How to execute X times a Job Executor step

简介

为简单起见,让我们想象一个简单的转换。 此转换从数据网格步骤获取 4 行的输入。 流通过一个作业执行器,引用一个简单的作业,带有一个写日志组件。

预期

我希望简单作业执行 4 次,即 4 条日志消息。

结果

事实证明,Job Executor 步骤仅启动简单作业一次,而不是 4 次:我只有一条日志消息。

提示

the Job Executor component 的文档指定了以下内容:

By default the specified job will be executed once for each input row.

这是在 "Row grouping" 选项卡中参数化的,具有以下字段:

The number of rows to send to the job: after every X rows the job will be executed and these X rows will be passed to the job.

回答

该步骤实际上运行良好:X 行的输入将执行 "Job Executor" 步骤 X 次。事实上,我无法通过日志看到它。

为了验证它,我在 "Job Executor" 步骤中添加了一个简单的转换,它写入一个文本文件。在我检查了这个文件之后,"Job Executor" 似乎被完美地执行了 X 次。

研究

为了理解为什么我在 "Job Executor" 执行 X 次后没有 X 日志消息,我在初始简单作业中添加了一个 "Wait for" 组件。最后,添加两秒让我看到执行过程中出现的 X 日志消息。

希望这对您有所帮助,因为它非常棘手。请随时提供更多详细信息。