How to Schedule Azure Batch Jobs to Run Only on Weekdays and Skip Weekends?

Stanley Ramakrishnan 40 Reputation points
2024-07-03T03:05:20.13+00:00

Hi,

I'm looking to configure an Azure Batch job schedule to run only on weekdays and skip weekends. From my research and forum interactions, I understand that the Weekdays attribute has been deprecated in the latest version.

Any guidance or examples would be greatly appreciated.

Thaks in advance

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
347 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 26,421 Reputation points
    2024-07-03T04:30:16.7866667+00:00

    Hello Stanley Ramakrishnan

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    You can use the Schedule property to specify the recurrence pattern for the job.

    Here's an example of how to configure an Azure Batch job schedule to run only on weekdays and skip weekends using the Schedule property:

    {
      "id": "myJobSchedule",
      "displayName": "My Job Schedule",
      "schedule": {
        "weekDays": [
          "Monday",
          "Tuesday",
          "Wednesday",
          "Thursday",
          "Friday"
        ],
        "startTime": "09:00",
        "endTime": "17:00",
        "interval": {
          "minutes": 30
        }
      },
      "jobSpecification": {
        "poolInfo": {
          "poolId": "myPool"
        },
        "jobManagerTask": {
          "id": "myJobManagerTask",
          "commandLine": "cmd /c echo Hello World"
        }
      }
    }
    

    In this example, the weekDays property specifies an array of weekdays on which the job should run. The startTime and endTime properties specify the start and end times for the job, and the interval property specifies the frequency at which the job should run.

    You can modify this example to suit your specific needs.

    Hope this helps.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.