如何在Microsoft托管代理池上的Azure Pipelines上实现作业的实际并行执行? [英] How to achieve actual parallel execution of jobs on Azure Pipelines on pool of Microsoft-hosted agents?

查看:74
本文介绍了如何在Microsoft托管代理池上的Azure Pipelines上实现作业的实际并行执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单但很慢(〜15分钟)的节点测试,我想在Ubuntu和Linux上运行,并且分别在节点6、8和10上运行-通过Azure管道总共6个工作"在Azure DevOps上.

I have a pretty simple but slow (~15 min) Node test that I want to run on Ubuntu and Linux, and for each on Node 6, 8 and 10 - so 6 "jobs" in total - via an Azure Pipeline on Azure DevOps.

我的azure-pipeline.yml看起来像这样:

jobs:
- job: Ubuntu
  pool:
    vmImage: 'Ubuntu 16.04'
  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x
  steps:
  - task: NodeTool@0
    inputs:
      version: $(node_version)
    displayName: 'Install Node.js $(node_version)'  
  - script: |
      npm install
    displayName: 'npm install'
  - script: |
      npm run test
    displayName: 'npm test'
- job: Windows
  pool:
    vmImage: 'vs2017-win2016'
  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x
  steps:
  - task: NodeTool@0
    inputs:
      version: $(node_version)
    displayName: 'Install Node.js $(node_version)'  
  - script: |
      npm install
    displayName: 'npm install'
  - script: |
      npm test
    displayName: 'npm test'

由于这是GitHub上的开放源代码存储库,所以我希望这6个测试运行可以并行进行(因为应该有10个并行作业).

As this is an open source repository on GitHub, I would have expected these 6 test runs to happen in parallel (as there should be 10 parallel jobs possible).

观察将azure-pipeline.yml添加到我的存储库中的pull请求的管道运行,似乎似乎只是有时候似乎正在进行一些并行处理.我经常等几分钟开始任何工作.这可能是Azure管道方面的容量问题,没有可用的代理来运行测试吗?

Observing the pipeline runs of the pull request adding the azure-pipeline.yml to my repository, it seems like there only sometimes seems to be some parallelism going on. Often I wait minutes for any job to start. Is this maybe a capacity problem on Azure Pipelines side, that no agents to run the tests are available?

启动某件事时,每个操作系统通常只有一项工作,而matrix中的其他任务是未启动/已排队". matrix作业不应该并行执行吗?

When something starts, it is mostly just 1 job per operating system, while the others from the matrix are "Not started / Queued". Shouldn't matrix jobs be executed in parallel?

这带给我我真正的问题:
有没有办法在Microsoft托管代理的池上的Azure Pipelines上实现作业的实际并行执行?

Which brings me to my real question:
Is there a way to achieve actual parallel execution of jobs on Azure Pipelines on the pools of Microsoft-hosted agents?

推荐答案

更改

  strategy:
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x

  strategy:
    maxParallel: 3
    matrix:
      node_6_x:
        node_version: 6.x
      node_8_x:
        node_version: 8.x
      node_10_x:
        node_version: 10.x

(请注意附加的maxParallel: 3)似乎已经完成了该工作:现在,一旦对PR分支进行了提交,构建就一起开始了.

(note the additional maxParallel: 3) seems to have done the job: The builds are now started all together as soon as the commit to the PR branch is made.

maxParallel当前仅记录为,看来完全需要matrix配置的并行性.

While maxParallel is currently only documented as "restricts the amount of parallelism.", it seems to be needed to get parallelism for matrix configurations at all.

(作业中的文档YAML模式没有帮助,因为它显示maxParallel作为matrixparallel的替代.)

(Documentation for Job in the YAML schema doesn't help as it shows maxParallel as an alternative to matrix or parallel.)

这篇关于如何在Microsoft托管代理池上的Azure Pipelines上实现作业的实际并行执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆