【问题标题】:Setting an Azure Scheduler Job Retry Policy设置 Azure 调度程序作业重试策略
【发布时间】:2014-10-20 19:34:57
【问题描述】:

使用 Azure 管理 REST API,我正在尝试使用重试策略更新 (PATCH) 现有调度程序作业。请求被接受,但 json 响应对象不包含重试策略条目。

在更新的情况下,我所做的其他更改会反映在响应中。

Azure Scheduler 作业实体结构:http://msdn.microsoft.com/library/azure/dn528941.aspx

Azure 调度程序 REST API 参考:http://msdn.microsoft.com/en-us/library/azure/dn528946.aspx

我一直在使用 Burp Suite 快速迭代不同的请求,但我从未看到任何表明已创建重试策略的信息。

我错过了什么?

以下请求将创建一个新的作业名称 SampleJob20(没有重试策略)

PUT /<subid>/cloudservices/<cloudservicename>/resources/scheduler/~/JobCollections/<jobcollectionname>/jobs/SampleJob20?api-version=2014-04-01 HTTP/1.1
Content-Type: application/json
x-ms-version: 2012-03-01
Host: management.core.windows.net
Content-Length: 583



{
    "startTime": "2013-01-30T12:08:00-08:00",
    "action":
    {
        "type": "http",
        "request":
        {
            "uri": "http://bing.com/",
            "method": "GET",
            "headers": 
            {
                "Content-Type": "text/plain"
            }
        }
    },
    "recurrence":
    {
        "frequency": "minute",
        "interval": 30,
        "count": 1000
    },
    "state": "enabled"
}

这个请求的响应是:

HTTP/1.1 201 Created
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 364
Content-Type: application/json; charset=utf-8
Expires: -1
Server: 1.0.6198.148 (rd_rdfe_stable.141019-1428) Microsoft-HTTPAPI/2.0
x-ms-servedbyregion: ussouth2
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
x-ms-request-id: xxxxxxxxxxxxxxxxx
Date: Mon, 20 Oct 2014 19:13:40 GMT

{
    "id":"SampleJob20",
    "startTime":"2013-01-30T20:08:00Z",
    "action":
    {
        "request":
        {
            "uri":"http:\/\/bing.com\/","method":"GET",
            "headers":
            {
                "content-Type":"text\/plain"
            }
        },
        "type":"http"
    },
    "recurrence":
    {
        "frequency":"minute",
        "count":1000,
        "interval":30
    },
    "state":"enabled",
    "status":
    {
        "nextExecutionTime":"2014-10-20T19:38:00Z",
        "executionCount":0,
        "failureCount":0,
        "faultedCount":0
    }
}

当我尝试使用重试策略更新此作业时。响应缺少重试策略详细信息。

PATCH /<subid>/cloudservices/<cloudservicename>/resources/scheduler/~/JobCollections/<jobcollectionname>/jobs/SampleJob20?api-version=2014-04-01 HTTP/1.1
Content-Type: application/json
x-ms-version: 2012-03-01
Host: management.core.windows.net
Content-Length: 451



{
    "id": "SampleJob20",
    "action":
        {
            "type": "http",
            "request":
            {
                    "uri": "http://bing.com",
                    "method": "GET",
                    "headers": 
                    {
                        "Content-Type": "text/plain"
                    }
            },

            "retryPolicy": 
            {
                "retryType":"fixed",
                "retryInterval": "PT1M",
                "retryCount": 3
            }
        }
}

如果我使用重试策略创建新作业,则响应包含重试详细信息。但是,作业重试策略也无法更新。

【问题讨论】:

    标签: azure scheduler


    【解决方案1】:

    你能试试像这样放置一个新的或相同的作业吗(它在 Put 请求中包含重试策略)

    {
    "startTime": "2013-01-30T12:08:00-08:00",
    "action":
    {
        "type": "http",
        "request":
        {
            "uri": "http://bing.com/",
            "method": "GET",
            "headers": 
            {
                "Content-Type": "text/plain"
            }
        },
           "retryPolicy": 
            {
                "retryType":"fixed",
                "retryInterval": "PT1M",
                "retryCount": 3
            }
    },
    "recurrence":
    {
        "frequency": "minute",
        "interval": 30,
        "count": 1000
    },
    "state": "enabled"
    }
    

    【讨论】:

    • 是的,这工作正常。重试策略已设置。如果我随后发送另一个 PUT 并更改重试策略(或任何其他更改),这将反映在响应中。问题在于提交 PATCH 请求。当我提交 PATCH 请求说更改 URL 时,这可以正常工作。如果我发送了一个 PATCH 请求来更新重试策略(将其更改为 retryCount 为 4),这将不起作用。
    • 安迪,我们还不支持重试策略的路径。我现在已经添加了它,你应该能够提出与上述问题相同的补丁请求并看到它成功。(从现在起大约 2 周内发货)
    猜你喜欢
    • 1970-01-01
    • 2020-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-25
    • 1970-01-01
    • 1970-01-01
    • 2018-07-03
    相关资源
    最近更新 更多