iris-cron-task


Follow
0
Star
0
Details
Releases
Issues
This application is not supported by InterSystems Corporation. Use it at your own risk.

What's new in this version

module description and icon added

iris-cron-task

Class to setup tasks running at schedule

Installation

Installation with ZPM

USER>zpm "install iris-cron-task"

Installaton with importing class

Import the class into your system.

testing with docker and collaboration

Clone/git pull the repo into any local directory

$ git clone https://github.com/intersystems-community/objectscript-docker-template.git

Open the terminal in this directory and run:

$ docker-compose build
  1. Run the IRIS container with your project:
$ docker-compose up -d

How to Test it

Open IRIS terminal:

$ docker-compose exec iris iris session iris
USER>

Run "set ^A($I(^A))=$H" every minute:

USER>zw ##class(dc.cron.task).Start("* * * * *","s ^A($I(^A))=$H",1,.taskId)

taskId contains the id of the task created: UZER>w taskId 1000

It will store in a global ^A the something like the following: USER>zw ^A ^A=6 ^A(1)="65732,54180" ^A(2)="65732,54240" ^A(3)="65732,54300" ^A(4)="65732,54360" ^A(5)="65732,54420" ^A(6)="65732,54480"

Run "set ^B($I(^B))=$H" every hour:

USER>zw ##class(dc.cron.task).Start("0 * * * *","s ^B($I(^B))=$H",1,.taskId)

Run "set ^A($I(^A))=$H" every day at midnight:

USER>zw ##class(dc.cron.task).Start("0 0 * * *","s ^C($I(^C))=$H",1,.taskId)

And you can delete the task when you don't need it anymore.

USER>zw ##class(dc.cron.task).Kill(taskId)

Collaboration

You are very welcome to collaborate and make changes. Fork the repository and send Pull Request.

Below I describe how to make changes in ObjectScript part:

Prerequisites

Make sure you have git and Docker desktop installed.

This repository is ready to code in VSCode with ObjectScript plugin. Install VSCode, Docker and ObjectScript plugin and open the folder in VSCode. Open /src/cls/PackageSample/ObjectScript.cls class and try to make changes - it will be compiled in running IRIS docker container. docker_compose

Feel free to delete PackageSample folder and place your ObjectScript classes in a form /src/Package/Classname.cls Read more about folder setup for InterSystems ObjectScript

The script in Installer.cls will import everything you place under /src into IRIS.

What's inside the repository

Dockerfile

The simplest dockerfile which starts IRIS and imports code from /src folder into it. Use the related docker-compose.yml to easily setup additional parametes like port number and where you map keys and host folders.

.vscode/settings.json

Settings file to let you immedietly code in VSCode with VSCode ObjectScript plugin)

.vscode/launch.json

Config file if you want to debug with VSCode ObjectScript

Read about all the files in this artilce

ZPM installation
zpm "install iris-cron-task"
Category
Technology Example
Works with
InterSystems IRISInterSystems IRIS for Health
Tags
Info
Version
1.0.2
Last updated
2020-12-20
Repository
Open
Documentation
Open
License
Link