首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >浅谈如何延迟天蓝色管道段

浅谈如何延迟天蓝色管道段
EN

Stack Overflow用户
提问于 2022-09-12 16:42:07
回答 1查看 256关注 0票数 0

我有一条天蓝色的管道,有三个阶段

  1. 向用户发送资源将被删除的通知

  1. 请求批准并等待24小时

  1. 删除资源

我的管道已经准备好了,但是我无法在第二阶段等待24小时,60分钟后的延迟任务超时和调度功能不能为我工作,因为在其他管道完成时会触发pipeilne

代码语言:javascript
复制
schedules:
- cron: "31 17 * * *"
  displayName: every Every 24 hours execution for delete the aci if anything change in the branche main
  branches:
    include:
    - main
    - releases/*
    exclude:
    - releases/old/*

# Trigger this pipeline on model-train pipeline completion
trigger: none
resources:
  containers:
  - container: mlops
    image: mcr.microsoft.com/mlops/python:latest
  pipelines:
  - pipeline: deploy-to-aci-dev
    source: Deploy-to-aci-dev # Name of the triggering pipeline
    trigger:
      branches:
        include:
        - master

variables:
- template: estimation_engine-variables-template.yml
- group: devopsforai-aml-vg

stages:
- stage: 'Delay'
  displayName: 'Delay for 24 Hours'
  jobs:
  - job: "Send_notif_sendgrid"
    displayName: "send deletion notification for dev aci - sendgrid"
    pool:
      vmImage: 'windows-2019'
    timeoutInMinutes: 60
    steps:
    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
          Install-Module -Name PSSendGrid -Force
          Import-Module -Name PSSendGrid
          $Parameters = @{
              FromAddress     = "***************************"
              ToAddress       = "***************************"
              Subject         = "Dev-Aci sera supprimé dans 24 heures"
              Body            = "Azure container instance dans l'environnement Dev sera supprimé dans 24 Heures"
              Token           = "*******************************************"
              FromName        = "Pipeline Alert"
              ToName          = "DigitRE"
          }
          Send-PSSendGridMail @Parameters
- stage: 'DELETE_ACI'
  displayName: 'Delete Dev ACI'
  condition: variables['ACI_DEPLOYMENT_NAME_DEV']
  jobs:
  - job: "DELETE_ACI"
    displayName: "Delete Dev Aci"
    container: mlops
    timeoutInMinutes: 0
    steps:
    - task: AzureCLI@1
      displayName: 'Install AzureML CLI'
      inputs:
        azureSubscription: '$(WORKSPACE_SVC_CONNECTION)'
        scriptLocation: inlineScript
        inlineScript: |
          set -e # fail on error
          az container delete -n $(ACI_DEPLOYMENT_NAME_DEV) -g  $(RESOURCE_GROUP)  --yes -y ```
EN

回答 1

Stack Overflow用户

发布于 2022-09-13 07:04:06

60分钟后的延迟任务超时()

对于Microsoft主机代理来说,不可能无限期地占用VM。

这里已经清楚地告诉你:

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?tabs=yaml&view=azure-devops#timeouts

将值设置为零意味着作业可以运行:

1,永久使用自托管代理2,在带有公共项目和公共存储库的微软托管代理上使用360分钟(6小时),在带有私有项目或私有存储库的Microsoft托管代理上使用60分钟(除非支付额外的容量)。帮助并行工作,取消每月的时间限制,并允许您运行每项工作最多360分钟(6小时)。

对于您的24小时要求,唯一的方法是使用自主机代理,但您使用的是Microsoft主机代理。

调度函数无法工作,因为在其他管道完成上触发了pipeilne

我认为这两个人应该相互独立。你为什么认为后者影响了前者?

请遵循以下故障排除步骤:

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers?view=azure-devops&tabs=yaml#i-defined-a-schedule-in-the-yaml-file-but-it-didnt-run-what-happened

1,检查Azure管道为您的管道计划的接下来几次运行。您可以通过选择管道中的计划运行操作来找到这些运行。列表将被过滤,仅显示接下来几天内的几次运行。如果这不符合您的期望,那么可能是您错误地输入了cron计划,或者您没有在正确的分支中定义时间表。阅读上面的主题,了解如何配置计划。重新评估您的cron语法。所有用于cron计划的时间都在 UTC.中。

2 .对YAML文件做一个微小的更改,并将更新推到存储库中。如果以前从YAML文件读取计划时有任何问题,应该立即修复。

3 .如果您在UI中定义了任何计划,那么您的YAML计划就不会得到遵守。确保您没有任何UI计划,方法是导航到管道编辑器,然后选择触发器。

4、对管道的运行时间是有限制的。

5 .如果您的代码没有更改,则Azure管道可能不会启动新的运行。

让我知道以上这些是否能帮助你更清楚地理解。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73692559

复制
相关文章

相似问题

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