简体   繁体   English

Spring批处理多步骤与单步骤

[英]Spring Batch Multiple Steps vs Single Step

I am building a Spring Batch application. 我正在构建一个Spring Batch应用程序。
Suppose that I have a Job which executes, for example: 假设我有一个执行的作业 ,例如:

  • Split an audio file 分割音频文件
  • Perform Speech-To-Text 执行语音转文字
  • Suppose that I have a TaskExecutor, allowing the Chunk -oriented step(s) to be parallelyzed. 假设我有一个TaskExecutor,允许并行执行面向步骤。

    Are there any benefits in using 2-Steps instead of putting all these operations in a single one? 使用两步操作而不是将所有这些操作都放在一个操作中有什么好处?

    My doubt is that using 2-Steps causes the "already finished files" to wait for all the pool to complete, causing inefficiency. 我的疑问是,使用两步操作会导致“已完成的文件”等待所有池完成,从而导致效率低下。

    Thanks in advance 提前致谢

    I would recommend doing this in two steps. 我建议分两个步骤进行。 The main reason is error handling. 主要原因是错误处理。 I'd assume that once you split the file, you won't want to have to do that again if there is an error on the speech-to-text processing. 我假设一旦分割了文件,如果语音到文本处理出现错误,您将不需要再次执行该操作。 If that is the case, by separating the processing into two steps, the split functionality won't need to be rerun. 在这种情况下,通过将处理分为两个步骤,无需重新运行拆分功能。 Also, it means that the chunk oriented processing can be more stateful in that the chunks that have been processed successfully won't need to be re-executed. 同样,这意味着面向块的处理可以更加有状态,因为已成功处理的块将不需要重新执行。 Yes, you could code this functionality yourself to behave this way, but Spring Batch provides the functionality out of the box...why not take advantage of it? 是的,您可以自己编写此功能的代码以使其表现为这种方式,但是Spring Batch提供了开箱即用的功能...为什么不利用它?

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM