Question
NIIT-Tech
CA
Last activity: 23 Oct 2017 11:22 EDT
Process Scheduling
One way to trigger scheduled automation is using windows scheduler but once the process is deployed to different resource machines, then do we have to customize scheduling in windows task scheduler for each and every machine?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
You could try using the System.Timers.Timer Class to perform this functionality. Start the Timer when the project is started and use the Elapsed Event to trigger the automation.
https://msdn.microsoft.com/en-us/library/system.timers.timer.elapsed(v=vs.110).aspx
NIIT-Tech
CA
Ok but here I want by project to start on its own with a scheduled time rather than first starting a project manually and then triggering the timer.
Pegasystems Inc.
US
As you've suggested, you can start the solution through the Task Scheduler. That really is going to be your only option to Start the process (OpenSpan.Runtime.exe) on its own. In your automation, you can use the DateTimeUtil to calculate the interval (time) that you want the automation to go off, then start the timer. If it is a repeated event, then you can set the AutoReset to True or have multiple Timers.
NIIT-Tech
CA
Can you explain a little more please. I understood that the runtime.exe needs to be mentioned in the task scheduler and also including the project name to start the automation. Now how will I use datetimeutil to achieve the above you explained.? Does my automation start with some datetimeutil event?
Pegasystems Inc.
US
I suppose I am just saying that it is possible to calculate the difference between when the Solution is started and when you want to run the automation and then set the Timer.Interval property as that value. The DateTimeUtil has methods to get the system time with DateTimeUtils.Now() which you can use for that. This is a specific usecase but regardless, the Timer should meet your needs.
NIIT-Tech
CA
What i have been able to understand is runtimeconfig is what will start my project, and the way to kick runtime config is through taskschedular actions.
But how do i control the runtime exe execution time in the automation,i know we can set the time for runtime exe to execute daily or weekly etc in taskschedular triggers but thats not something which will be a general solution because if there are like 50 resources to deploy the project,do i have to keep setting the timing in each and every task schedular of machine?
So inside the automation,even if i am using the timer,it wont be of use because first i want to set the time for runtime config to start on its own
Forexample here below in the attached file,using the time elapsed event i am controlling when the application should start but i am still not controlling when should runtime config be executed to start the whole process.
I hope i am making my question clear?
Pegasystems Inc.
US
Here is how you would do that.
You should stop the timer when you start your process. You probably won't get an exact match (seconds and milliseconds count in the comparison) so start the process on either Exact Match or Time Passed. The timer is set to fire every minute - this should be accurate enough and not create an overload on the machine.
-
Thaveesha Cabral Shilpa Lonka
NIIT-Tech
CA
Thanks Jeff, this was really helpful to clear some doubts. Now that we have set the code for our automation to run at a specific time, is there a way I can do the code for running the runtime config at a specific time of the day rather than setting its time in task scheduler?
Pegasystems Inc.
US
I think what Mitchell is saying is that you can use the dateTimeUtils and timers to determine when a process should run if the Runtime is started.
In my experience, if you have a process that runs and then waits a period of time before running again, the best way to handle is to have the process shut down after it runs. Use the Task Scheduler to start the process again next time it needs to run. This will consume less system resources and your programming will only need to account for a single successful run. You can adjust the frequency externally by modifying the Task Scheduler.