Page 1 of 1

Kill RUNTI after x minutes from cmd line

Posted: Tue Jul 07, 2015 5:32 am
by 7Zark7
Hi All,

We have had a small number of times where our trusty RUNTI process continues to run indefinitely.

Is it possible to wrap something around a RUNTI script in cmd line that kills the task if it exceeds x minutes?

Been racking my brain on this one for a little while and was going go flick it off to IT but before I do, I thought I would run it past the brains trust first.

Any ideas? My cmd line scripting is pretty limited.

Cheers

Zark

Re: Kill RUNTI after x minutes from cmd line

Posted: Tue Jul 07, 2015 7:58 am
by TrevorGoss
Hello Zark,

This wont be easy because as soon as the TI is called, nothing from the same command line can run.

I would start at the other end, with your TI, why does it run on inindefinitely? No TI should run indefinitely because it would never finish and provide solutions.

Do you have while loops running? Are you importing data?

You should only kill a running TI if it has gone wrong, if the TI does not go wrong, then you have no need to kill it.

Trevor.

Re: Kill RUNTI after x minutes from cmd line

Posted: Wed Jul 08, 2015 2:31 am
by 7Zark7
Hey Mate,

Thanks for the feedback. Process is fairly simple and has runs perfectly 99.9% of the time. The only thing I can think of that could possible
cause a thread to just hang like that is due to some sort of network related issue... anyway I was able to come up with a solution. In the end
it was pretty straight forward:

1.Essentially you need to create a "Watcher" process in 1 thread and then the second process in a second thread. In order to run them
concurrently you will need to both processes via RUNTI.

2. The watched process outputs a file to a directory and the WATCHING process waits via sleep command for an appropriate
amount of time and then checks for that file ( to see if the process is still running ), if it is it then deletes the file and then
issues a TASKKILL command the cmd.exe process on the server.

Because RUNTI is run via cmd.exe the process is then killed off and no longer runs.

Again, to make this all work RUNTI must be used.

Cheers

Zark

Re: Kill RUNTI after x minutes from cmd line

Posted: Wed Jul 08, 2015 8:02 am
by TrevorGoss
Hello again,

Code: Select all

 Process is fairly simple and has runs perfectly 99.9% of the time. The only thing I can think of that could possible
cause a thread to just hang like that is due to some sort of network related issue
You could create logs, textfiles, inside the TI at certian points of the script and when the TI fails you can find out at what point it failed, as it is killed it will not return a line for an error.

You could also run the TI in a master TI with the ability to get the return value and if it did, or did not run successfully,minor errors..etc you can find out why it is failing. This master TI can still be called from the cmd line.

Code: Select all

Essentially you need to create a "Watcher" process in 1 thread and then the second process in a second thread. In order to run them
concurrently you will need to both processes via RUNTI.
This sounds workable but it also sounds rough, what if the network related issue causes the "Watcher" process to fail? It seems as if you could go on a cycle of watching the watchers.

Thanks.

Trevor.

Re: Kill RUNTI after x minutes from cmd line

Posted: Wed Jul 08, 2015 11:14 am
by lotsaram
7Zark7 wrote:Hey Mate,

Thanks for the feedback. Process is fairly simple and has runs perfectly 99.9% of the time. The only thing I can think of that could possible
cause a thread to just hang like that is due to some sort of network related issue... anyway I was able to come up with a solution. In the end
it was pretty straight forward:

1.Essentially you need to create a "Watcher" process in 1 thread and then the second process in a second thread. In order to run them
concurrently you will need to both processes via RUNTI.

2. The watched process outputs a file to a directory and the WATCHING process waits via sleep command for an appropriate
amount of time and then checks for that file ( to see if the process is still running ), if it is it then deletes the file and then
issues a TASKKILL command the cmd.exe process on the server.

Because RUNTI is run via cmd.exe the process is then killed off and no longer runs.

Again, to make this all work RUNTI must be used.

Cheers

Zark
I'm not sure how you think this is supposed to work. But maybe you haven't explained your problem properly. Is it that you have instances of cmd.exe from runti that never close off or the actual TI processes on the tm1 instance itself (from runti) never complete? Because if it's the later then I can't see how a task kill on the cmd.exe will help. It will clean up the dead client interface sure, but the hung TI process won't be affected.

Much the same as if you set of a long running TI process from architect then deliberately crash architect; the TI process will finish in its own time when finished. It doesn't magically terminate just because the client session has been forcibly closed.

Re: Kill RUNTI after x minutes from cmd line

Posted: Thu Jul 09, 2015 12:46 am
by 7Zark7
Hi Lotsa,

Your quite right in saying that TI process will just continue on even after killing of the cmd.exe. In this case, the process just continued on for ever. Usually the process takes 2 minutes at the very most, but on this occasion ran for 90000 seconds! The process is fine and has been well tested. Its only the 3rd time in the last year
I have seen this happen. So when this process is run, we now have to WATCH it to make sure the thread dies off after it finishes within the 2 minutes and if its exceeds a running time of 5 minutes the watcher process then issues a TASKKIL command, the thread then dissappears. Its as though the process has finished long ago, but the system still thinks its running.......really really strange.

Based on your experience have you ever encountered something like this before??

Cheers

Zark