英文:
Is it possible in Azure DevOps Pipelines to wait for enough agents to run the job
问题
我们遇到了以下问题:
我们的流水线中有一个运行测试的作业。测试的数量需要分配给4个代理以实现最佳运行效果。可能出现只有一个代理可用的情况,而作业将开始在该特定代理上运行所有负载,这可能会因为其他代理在时间内无法可用而超时。
实质上,如果我们使用4个代理运行,该作业将以最佳效率运行。
我的问题是:是否有可能让作业等待特定数量的代理在开始任务之前可用?
英文:
We are running into the following issue:
We have a job in our pipeline that runs tests. The number of tests need to be distributed over 4 agents to run optimal. It can happen that only one agent is available and the job will start to run all the load on that specific agent, which can then time-out because it takes too long for other agents to become available in time to share in the load.
In essence, if we run with 4 agents, the job will run with optimal efficiency.
My question: is it possible to let a job wait for a specific number of agents to become available before starting the tasks in the job?
答案1
得分: 1
这不是通过开箱即用的功能实现的... 但是你可以创建一个简单的PowerShell脚本来查询你的代理状态: https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/agents/list?view=azure-devops-rest-7.1
并使用 includeAssignedRequest
GET
https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}/agents?includeAssignedRequest={includeAssignedRequest}&api-version=7.1-preview.1
如果你看到 assignedRequest
,你的构建代理正在忙碌...
英文:
That`s not possible through out-of-box features.... But you may create a simple PowerShell script that will query your agents statuses: https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/agents/list?view=azure-devops-rest-7.1
and use includeAssignedRequest
GET
https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}/agents?includeAssignedRequest={includeAssignedRequest}&api-version=7.1-preview.1
if you see assignedRequest
, your build agent is busy...
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论