ADF trigger settings to skip weekends and first 3 days of the month.

Manoj Vavikadai Parthasarathy 0 Reputation points
2024-05-14T14:39:51.4533333+00:00

Requirements are:

  1. Job should run only on weekdays.
  2. Job should skip the run on the first three days of the month (1st,2nd and 3rd dates)

Problem:

  1. Monthly Occurrence: In ADF trigger we have an option to skip the days on a month if we schedule monthly occurrence where it is not possible to skip the weekends
  2.  Weekly Occurrence: On the other hand, we have option to skip weekends but dont have options to skip first 3days of the month.

Solutions tried: 

  1. I have modified the JSON with monthDays <4 to 31> and weekdays  
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,773 questions
{count} votes

1 answer

Sort by: Most helpful
  1. phemanth 6,810 Reputation points Microsoft Vendor
    2024-05-15T04:53:40.5733333+00:00

    @Manoj Vavikadai Parthasarathy

    Thanks for using MS Q&A platform and posting your query.

    Here are two possible solutions for scheduling the job to run only on weekdays, skipping the first three days of the month in ADF triggers:

    Solution 1: Combining Monthly and Weekly Triggers

    Create two triggers:

    1. Monthly Trigger: Set the recurrence to "Monthly" and select the desired day of the week (e.g., Tuesday).
    2. Weekly Trigger: Set the recurrence to "Weekly" with weekdays selected (Monday to Friday).
    • In the "Conditions" section of the monthly trigger, add a condition that checks the day of the month. You can use an expression like dayOfMonth > 3 to ensure the trigger only fires after the 3rd day.
    • The job will only run if both triggers fire:
    • The monthly trigger fires on the desired weekday.
    • The daily condition ensures it's past the 3rd day.
    • The weekly trigger ensures it's a weekday.

    Solution 2: Using a Custom Scheduler Script (More Complex)

    1. Develop a custom script that checks the current date and day of the week. The script should only return true if it's a weekday between the 4th and the end of the month.
    2. Use this script as the scheduling expression for your ADF trigger.

    Here's why Solution 1 is recommended:

    • It leverages existing functionalities within ADF, making it easier to implement and maintain.
    • It's visually clearer in the trigger configuration compared to a custom script.

    Hope this helps. Do let us know if you any further queries.

    0 comments No comments