Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

Advanced Scheduling in Qlik Sense Enterprise SaaS

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Levi_Turner
Employee
Employee

Advanced Scheduling in Qlik Sense Enterprise SaaS

Last Update:

Apr 6, 2022 9:01:28 AM

Updated By:

Levi_Turner

Created date:

Apr 6, 2022 9:01:28 AM

Objective:

For this document, we will review how to leverage Qlik Sense Enterprise SaaS' open APIs to build advanced reload schedules.

Requirements:

Background:

Qlik Sense Enterprise SaaS implements reload schedules based on the RFC 5545 specification which is commonly known as rrule. The GUI presents a common subset of possible schedules with GUI-based options including hourly, daily, weekly, monthly, and yearly.

Qlik Sense Enterprise SaaS additionally exposes scheduling based on IANA Time Zone Database names. While this guide is written with a timeZone parameter set as America/New_York, refer to further documentation on additional permitted options.

This guide will use qlik-cli to abstract the RESTful API requests to build the reload task. There are additional parameters exposed in the qlik reload-task create command (e.g. partial reloads). Refer to qlik-cli's documentation for further guidance. For integrations where interaction occurs outside of qlik-cli, an example body of a reload task creation is as follows:

 

{
  "appId": "58f563b6-ccda-45b0-926c-e2992ca8b470",
  "recurrence": [
    "RRULE:FREQ=MINUTELY;INTERVAL=15"
  ],
  "startDateTime": "2022-03-23T00:00:00",
  "timeZone": "America/New_York",
  "type": "scheduled_reload"
}

 

This guide was written for use with the Windows PowerShell program. While PowerShell can be run on non Windows systems, use of bash techniques for parsing json (e.g. jq) is possible but not covered in this guide.

Examples of advanced schedules:

Reload a specific app every 15 minutes

 

# Specify the appId
$appId = '<myAppId>'
# Define the rrule
$schema = 'RRULE:FREQ=MINUTELY;INTERVAL=15'
$startDate = ((Get-Date)).ToString("yyyy-MM-ddT00:00:00") # Get the current date and convert to required format
# Get the app's reload tasks
$reloadTask = qlik reload-task ls --appId $($appId) | ConvertFrom-Json
# Delete the associated reload task, if present
if($reloadTask.data.Length -gt 0) {
    $null = qlik reload-task rm $($reloadTask.data.id)
}
# Create the task
$null = qlik reload-task create --appId $appId --recurrence $schema --startDateTime $startDate --timeZone "America/New_York" --type "scheduled_reload"

 

 

Reload a specific app every hour on Thursday

 

# Specify the appId
$appId = '<myAppId>'
# Define the rrule
$schema = 'RRULE:FREQ=HOURLY;INTERVAL=1;BYDAY=TH'
$startDate = ((Get-Date)).ToString("yyyy-MM-ddT00:00:00") # Get the current date and convert to required format
# Get the app's reload tasks
$reloadTask = qlik reload-task ls --appId $($appId) | ConvertFrom-Json
# Delete the associated reload task, if present
if($reloadTask.data.Length -gt 0) {
    $null = qlik reload-task rm $($reloadTask.data.id)
}
# Create the task
$null = qlik reload-task create --appId $appId --recurrence $schema --startDateTime $startDate --timeZone "America/New_York" --type "scheduled_reload"

 

 

Reload a specific app on the 2nd Monday of the month

 

# Specify the appId
$appId = '<myAppId>'
# Define the rrule
$schema = 'RRULE:FREQ=MONTHLY;WKST=MO;BYDAY=MO;BYSETPOS=2'
$startDate = ((Get-Date)).ToString("yyyy-MM-ddT00:00:00") # Get the current date and convert to required format
# Get the app's reload tasks
$reloadTask = qlik reload-task ls --appId $($appId) | ConvertFrom-Json
# Delete the associated reload task, if present
if($reloadTask.data.Length -gt 0) {
    $null = qlik reload-task rm $($reloadTask.data.id)
}
# Create the task
$null = qlik reload-task create --appId $appId --recurrence $schema --startDateTime $startDate --timeZone "America/New_York" --type "scheduled_reload"

 

 

  • Note: The hour  which the reload is executed with daily / monthly / yearly is determined by the startDateTime value. In this example, the value is set to midnight, adjustment to align with desired business or batch hour is encouraged.

 

Labels (2)
Comments
ChristofSchwarz
Partner Ambassador
Partner Ambassador

Note that when you create a reload task, you will have to encode the --recurrence argument in a way so that it starts and closes with a \" (backslash-doublequote). Every shell language will have its own way of encoding, for example this does it in *CMD* (Windows Command Prompt):

qlik reload-task create --appId "94782545-ae29-49e9-8b4b-41b3ac58dfc2" --recurrence \^"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0,2,4,6,8,10,12,14,16,18,20,22;BYMINUTE=0;BYSECOND=0\^" --timeZone "Europe/Zurich"

This will do the trick in *PowerShell* (in one line, without going via a variable definition as shown above):

.\qlik.exe reload-task create --appId 5cdefe35-91f1-4100-9524-73edb0d24247 --recurrence "\`"RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0,2,4,6,8,10,12,14,16,18,20,22;BYMINUTE=0;BYSECOND=0\`"" --timeZone "Europe/Zurich"

 

0 Likes
Contributors
Version history
Last update:
‎2022-04-06 09:01 AM
Updated by: