Friday, August 11, 2017

Activeeon Job Planner: in depth

Activeeon Job Planner: in depth

In the previous article, we already presented the new job planner, a tool to execute jobs periodically. Now let’s explore how to add exceptions: include or exclude specific dates. To sum up, be more flexible.
For example, if you want to send analytic reports each monday but not the day’s off, you can create a calendar which avoid these days. Or, if you execute a job once a month but need two extra ones, at the beginning and at the end of the summer, it is possible.

HOW TO USE IT ?


In the generic information, we can add two key-value pairs (in bold, below) : exclusion or inclusion, in the EXECUTION_CALENDARS json. EXECUTION_CALENDARS =
{
  "name": "Calendar",
  "cron": "0 * * ? * * *",
  "exclusion_calendars": [{
         "calendar": {
                   "url": "your/path/to/your/calendar_exclusion.ics"
         },
         "rule": {
                   "action": "CANCEL_NEXT_EXECUTION"
         }
  }]
}


EXECUTION_CALENDARS =
{
  "name": "Calendar",
  "cron": "0 0 12 1 * ? *",
  "inclusion_calendars": [{
         "calendar": {
                   "url": "your/path/to/your/calendar_inclusion.ics"
         },
         "rule": {
                   "action": "EXECUTE_AT_START"
         }
  }]
}


In red, it is the path where your inclusion or exclusion calendar is. Indeed, to add an exception, you have to create a calendar. You can do it easily with this website.

GOOD TO KNOW


  • For the exclusion, there is an interval but you should be careful because the start date won’t be executed but the end date will be (depending on your cron). For example, if you execute a job every minutes and you add an exclusion between 12h00 and 12h10, at 12h00 the job will not be executed, but at 12h10 it will be.
  • If an inclusion and an exclusion appears at the same time, the exclusion will take over and the job will not be executed.
  • Once the job is planned in the job planner, the calendar can’t be modified.

A FEW EXAMPLES


TEST 1 : Exclusion

Execute job every minutes, exclusion during 6 minutes
"cron": "0 * * ? * * *"



TEST 2 : Inclusion

Execute job, every first of the month, inclusion before the first day of the month
cron": "0 0 12 1 * ? *"



TEST 3 : An inclusion in the exclusion

Execute job every minutes, exclusion during 2 years, inclusion during
"cron": "0 * * ? * * *",



TEST 4 : 5 inclusions 1 exclusion

Execute job every 10 minutes, one exclusion and 4 inclusions (one before the the exclusion, three during, one after)
"cron": "0 0/10 * ? * * *"




To get more information, please see the documentation.

No comments:

Post a Comment