我有几百个文件需要进行测试(每个测试需要几分钟)。
顺序运行和全部一起运行都不可接受。因此,我正在寻找类似于生产者-消费者的东西。
我尝试了使用管道作业和以下方式的并行命令:
def files = findFiles glob: 'test_files/*'
def branches = [:]
files.each{
def test_command = "./test ${it}"
branches["${it}"] = { sh "${test_command} ${it}"}
}
stage name:'run', concurrency:2
parallel branches
问题:
所有任务同时启动(OOM和所有有趣的事情)
解决方案:
所有任务同时启动可能导致内存不足和其他问题。