且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将管道的一部分作为单独的作业运行

更新时间:2023-02-23 13:56:02

你可以做的是编写一个流水线脚本,在单个阶段周围有if"-guards,如下所示:

What you could do is to write a pipelining script that has has "if"-guards around the single stages, like this:

stage "s1"
if (theStage in ["s1","all"]) {
    sleep 2
}

stage "s2"
if (theStage in ["s2", "all"]) {
    sleep 2
}

stage "s3"
if (theStage in ["s3", "all"]) {
    sleep 2
}

然后,您可以通过将参数theStage"设置为all"来创建一个使用此脚本并同时运行所有阶段的主"作业.当所有阶段同时运行时,此作业将收集统计信息,并为您提供有用的估计时间.

Then you can make a "main" job that uses this script and runs all stages at once by setting the parameter "theStage" to "all". This job will collect the statistics when all stages are run at once and give you useful estimation times.

此外,您可以制作使用此脚本的部分运行"作业,并使用您要运行的阶段进行参数化.不过,估计不会很有用.

Furthermore, you can make a "partial run" job that uses this script and that is parametrized with the stage that you want to run. The estimation will not be very useful, though.

请注意,按照 Martin Ba 的建议,我将阶段本身放在主脚本中,并且只将执行代码放入条件中.这样可以确保作业的可视化更加可靠

Note that I put the stage itself to the main script and put only the execution code into the conditional, as suggested by Martin Ba. This makes sure that the visualization of the job is more reliable