Is it possible Triggering services/processes to run without a separate task?
Hi everyone.
I have a few processes where I rely on them being triggered by a schedule to run, and in the past I have relied on the following setup:
.png)
The Scheduled Task is a custom class that runs a minimal amount of code to simply create and send the specified service an Ens.Request, and equally the Service is also a custom class that simply passes the Ens.Request to the Process for it to kick the process off.
As scheduled tasks need to be configured on a per-mirror basis, I'd like to do away with it completely and simply have a service that just sends the Ens.Request to the Process based on a poll interval. This seems simple enough for tasks set to run every x minutes, but this doesn't seem to be suitable for instances where it needs to run once at a specific time.
Is there a better way for this to be set up, or is the task scheduling for this the best option?
Comments
@Julian.Matthews7786 You could try the Schedule option from Service
https://docs.intersystems.com/healthconnect20211/csp/docbook/DocBook.UI…
Also you could check the discussion here : https://community.intersystems.com/node/554071 , if that useful.
Hi Mary - thank you for your reply.
Unfortunately the Schedule Option isn't suitable where we need the job to run only once at a set time per day. And, our current solution is very similar to the accepted answer from Ashok Kumar, which is what I was hoping to simplify in some way.
"Unfortunately the Schedule Option isn't suitable where we need the job to run only once at a set time per day"
Why not? It is definitely possible to schedule to start every day at 8:00 for example using this schedule string:
START:*-*-*T08:00:00,STOP:*-*-*T08:10:00
You start a Business Service at 8:00 and stop it at 8:10 (for example).
All you need to take care is that the BS only make one call when started.
Enrico
We created a shell script that logs into the terminal and runs EnableConfigItem from the cron in Linux to schedule processes to run at certain times of the day.
Hi Julian,
As I put in a reply to the discussion that @Mary George linked to, you can easily get a Service to only run once at the start of each scheduled period by setting the CallInterval to a very large number so it never does a second call. /Mike
Well, I did something similar to create a Firebase connector, I created my own inbound adapter and define a business services to use it, after that I configured the interval in the business service and that's all!
You can review the article that I wrote about it:
https://community.intersystems.com/post/connecting-intersystems-iris-an…
For your case the interval would be 86400 seconds to execute the inbound adapter task once each day.
If you have any doubt don't hesitate to ask me.
Thanks Luis.
The issue I'd have is that the clock starts on the poll interval at the point the service is started, so a restart of the server/production would then shift the time of day it tries to run, which would not be ideal if I needed a single run at a specific time of day. I might try a combination of the large poll interval and defining a schedule (based on the other responses) and see if that has the desired effect, but I may need to just concede and continue using the task manager. 🙂
That's EXACTLY what a Schedule setting does in any Item/Business Host (Business Service in your case).
.png)
Enrico