首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Azure DevOps管道中并行作业数量的限制

Azure DevOps管道中并行作业数量的限制
EN

Stack Overflow用户
提问于 2019-03-06 17:57:53
回答 2查看 3.6K关注 0票数 1

我们的团队正在使用YAML模式创建一个Azure DevOps管道来运行我们的测试脚本,运行相同测试脚本的多个迭代。如何告诉作业运行相同的测试8次,但限制并行运行的最大测试数3?

Azure DevOps YAML模式引用展示了一种限制运行矩阵并行运行次数的方法:

代码语言:javascript
复制
job: Build
strategy:
  maxParallel: 2
  matrix:
    Python35:
      PYTHON_VERSION: '3.5'
    Python36:
      PYTHON_VERSION: '3.6'

但试着像

代码语言:javascript
复制
job: Build
strategy:
  maxParallel: 2
  parallel: 8

抛出一个错误,表示并行是一个意外的标识符。

EN

回答 2

Stack Overflow用户

发布于 2020-08-03 10:10:36

这是有点晚,但仍然希望为其他人提供一个答案。如果您查看以下文档:https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#define-a-single-job

它谈到了YAML工作的完整规范:

代码语言:javascript
复制
- job: string  # name of the job, A-Z, a-z, 0-9, and underscore
  displayName: string  # friendly name to display in the UI
  dependsOn: string | [ string ]
  condition: string
  strategy:
    parallel: # parallel strategy
    matrix: # matrix strategy
    maxParallel: number # maximum number simultaneous matrix legs to run
    # note: `parallel` and `matrix` are mutually exclusive
    # you may specify one or the other; including both is an error
    # `maxParallel` is only valid with `matrix`
  continueOnError: boolean  # 'true' if future jobs should run even if this job fails; defaults to 'false'
  pool: pool # agent pool
  workspace:
    clean: outputs | resources | all # what to clean up before the job runs
  container: containerReference # container to run this job inside
  timeoutInMinutes: number # how long to run the job before automatically cancelling
  cancelTimeoutInMinutes: number # how much time to give 'run always even if cancelled tasks' before killing them
  variables: { string: string } | [ variable | variableReference ] 
  steps: [ script | bash | pwsh | powershell | checkout | task | templateReference ]
  services: { string: string | container } # container resources to run as a service container

它声明了'parallel' and 'matrix' are mutually exclusive。这意味着您只能在矩阵策略中使用maxParallel。没有矩阵,你必须使用“并行”。

票数 2
EN

Stack Overflow用户

发布于 2019-03-06 18:01:30

我觉得应该是这样的:

代码语言:javascript
复制
jobs:
- job: xxx   
  strategy:
    parallel: 8 # parallel strategy, see below
    maxParallel: 3 # maximum number of agents to simultaneously run copies of this job on
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55029457

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档