mibuso.com

Microsoft Business Solutions online community
It is currently Mon Jul 28, 2014 10:29 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Solved] Terminate too long running process
PostPosted: Thu Jun 07, 2012 1:28 pm 
Offline

Joined: Wed May 02, 2012 10:21 am
Posts: 33
Country: Vietnam (vn)
I'm looking for a way to terminate a process which takes too much time to run ? Is there any way I can get this done ?
Let's take requesting to a webservice as an example: I expect one request should not exceed 3 minutes to get the result back. One would be marked as "Delay" if its request exceed the time limit.

I know we can solve this by limiting the request time, timeout time of service. But I'm looking for a more generic way, so it will help for another tasks as well.
Thanks for reading :)


Last edited by nXqd on Fri Jun 08, 2012 5:16 pm, edited 2 times in total.

Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running task
PostPosted: Thu Jun 07, 2012 1:30 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3493
Location: Wilrijk
Country: Belgium (be)
Please clarify "process"

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2014 - 20 & 21 November 2014 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Terminate too long running task
PostPosted: Thu Jun 07, 2012 4:43 pm 
Offline

Joined: Wed May 02, 2012 10:21 am
Posts: 33
Country: Vietnam (vn)
Luc Van Dyck wrote:
Please clarify "process"

Thanks for your reminding. I seem to post unclear thread, I will notice next time :)


Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running process
PostPosted: Thu Jun 07, 2012 7:52 pm 
Offline

Joined: Fri Nov 13, 2009 3:04 pm
Posts: 76
Location: Barcelona
Country: Spain (es)
I am not sure if i understand well the question but what i know you can control it:
- on the client side in the case of async. call -> set yourwsclient.Timeout parameter,
- on the server side -> setting of the OperationTimeout of your web service CustomSettings.config file.


Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running process
PostPosted: Thu Jun 07, 2012 11:27 pm 
Offline

Joined: Wed May 02, 2012 10:21 am
Posts: 33
Country: Vietnam (vn)
koubek wrote:
I am not sure if i understand well the question but what i know you can control it:
- on the client side in the case of async. call -> set yourwsclient.Timeout parameter,
- on the server side -> setting of the OperationTimeout of your web service CustomSettings.config file.


Like I said before, we can control it by setting the timeout in webservice setting. I'm thinking about another process like reading file, loading file, any process that can take long time to run. Like reading file, we can't config it externally. So thinking about navision, can we do this programmatically ?


Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running process
PostPosted: Thu Jun 07, 2012 11:53 pm 
Offline

Joined: Fri Nov 13, 2009 3:04 pm
Posts: 76
Location: Barcelona
Country: Spain (es)
The question is why your process does not end within 3 minutes if you expect it... And on the other hand, if the process runs longer but works correctly why would you like to terminate it?

Anyway, if you know what session your process is you can terminate it from another one if you need it. You can control it by the NAV code of course. Moreover when you run specific function as WS method you can control processing time inside NAV directly within the process itself...

All of this depends what exactly do you need... You should describe better your requirements to understand all details of your wishes :wink:


Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running process
PostPosted: Fri Jun 08, 2012 12:27 am 
Offline

Joined: Wed May 02, 2012 10:21 am
Posts: 33
Country: Vietnam (vn)
koubek wrote:
The question is why your process does not end within 3 minutes if you expect it... And on the other hand, if the process runs longer but works correctly why would you like to terminate it?

Anyway, if you know what session your process is you can terminate it from another one if you need it. You can control it by the NAV code of course. Moreover when you run specific function as WS method you can control processing time inside NAV directly within the process itself...

All of this depends what exactly do you need... You should describe better your requirements to understand all details of your wishes :wink:


It's great that I have someone follow my question this long since I don't describe my question clear and understandable enough. But due to your answer,
Quote:
And on the other hand, if the process runs longer but works correctly why would you like to terminate it?

The purpose of terminating it is time and performance is what I concern at the moment. Like I expect it to run in 3 minutes, even if it runs well in 5 minutes, it doesn't pass. And I also mark it as "Delaying", so later when I take a look at the process management, I can find out "Ah ha! This one is slow. Let's check why it is?"
Quote:
Moreover when you run specific function as WS method you can control processing time inside NAV directly within the process itself...

An example code for this one is more than great to me. I learn better through examples ;)

Thanks for reading.


Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running process
PostPosted: Fri Jun 08, 2012 6:55 am 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Thu Oct 16, 2003 8:50 am
Posts: 12433
Location: Brno
Country: Czech Republic (cz)
Example:

Code: Select all
Function start
Save the current date time
loop through the file
  for each read check if curent date time > starting one + 3 minutes
  if yes, error('Too long process');
  else continue in process


In each process, when something is long, it means that there is loop, whcih should end after some time. This you can check inside the loop. You cannot do that only if you are calling external function which is atomic for you and it itself take too long.

_________________
Kamil Sacek
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.


Top
 Profile E-mail WWW  
 
 Post subject: Re: Terminate too long running process
PostPosted: Fri Jun 08, 2012 7:56 am 
Offline

Joined: Fri Nov 13, 2009 3:04 pm
Posts: 76
Location: Barcelona
Country: Spain (es)
kine wrote:
In each process, when something is long, it means that there is loop, whcih should end after some time. This you can check inside the loop.
This is exactly what i meant.

kine wrote:
You cannot do that only if you are calling external function which is atomic for you and it itself take too long.
Just like kine said... Except the situation that the atomic function can be executed asynchronously (in this case usually a callback is provided) and you have some method to abort it.


Top
 Profile E-mail  
 
 Post subject: Re: Terminate too long running process
PostPosted: Fri Jun 08, 2012 5:16 pm 
Offline

Joined: Wed May 02, 2012 10:21 am
Posts: 33
Country: Vietnam (vn)
koubek wrote:
kine wrote:
In each process, when something is long, it means that there is loop, whcih should end after some time. This you can check inside the loop.
This is exactly what i meant.

kine wrote:
You cannot do that only if you are calling external function which is atomic for you and it itself take too long.
Just like kine said... Except the situation that the atomic function can be executed asynchronously (in this case usually a callback is provided) and you have some method to abort it.


Thanks you and kine for great answer and explanation. Thinking about aborting atomic funciton in nav, I think it's not possible at the moment and use case is rare. I will mark this as solved :)


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: