locked
JSON Format For JobSchedule RRS feed

  • Question

  • I am looking for help on the format for creating an array of JobSchedules within an Azure Batch Account.

    No matter the combination I try, I just can't seem to get the format right. Here is what I typically use for a single JobSchedule:

    {
        "id": "jobid-001",
        "displayName": "myjob-001",
        "schedule": {
            "doNotRunUntil": "2018-09-18T00:00:00.000Z",
            "recurrenceInterval": "PT7M"
        },
        "jobSpecification": {
            "constraints": {
                
            },
            "jobManagerTask": {
                "id": "task-001",
                "commandLine": "/myScript.sh",
                "constraints": {
                    "maxWallClockTime": null,
                    "retentionTime": null,
                    "maxTaskRetryCount": 0
                },
                "userIdentity": {
                    "autoUser": {
                        "scope": "pool",
                        "elevationLevel": "admin"
                    }
                },
                "resourceFiles": null,
                "environmentSettings": null,
                "containerSettings": null,
                "displayName": "task-001",
                "killJobOnCompletion": true,
                "runExclusive": false
            },
            "poolInfo": {
                "poolId": "mypool01"
            }
        }
    }

    <tmui style="top:1px;right:1px;"></tmui>


    teekon

    Thursday, September 13, 2018 4:48 PM

All replies

  • By the way, reason for asking this is so I can pass this json file to the Cloud Shell.<tmui style="top:1px;right:1px;"></tmui>

    teekon

    Thursday, September 13, 2018 6:03 PM
  • Thanks for reaching out. I am working offline to get an answer for you. Will update when I have more. 
    Friday, September 14, 2018 5:47 PM
  • So in Batch we don't have any API/Cli that supports array of JobSchedules.

    For gernal JSON templates an  array of object will be like:     [

                {
                          … job schedule 1
                },
                {
                          … job schedule 2
                }
         ]

    Could you give that a go?

    Friday, September 14, 2018 10:24 PM
  • In addtion, I also heard back the following related to your ask:

    I believe the CLI is just acting as a wrapper here, submitting the supplied JSON directly to the Azure Batch REST API.

    The Batch Add Job Schedule API only supports a single Job Schedule for each request.

    I therefore would suggest that the solution is to create a series of JSON files that are each submitted independently via the CLI.


    Saturday, September 15, 2018 3:24 PM