Terminate too long running process

nXqdnXqd Member Posts: 39
edited 2012-06-08 in NAV Three Tier
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 :)

Answers

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Please clarify "process"
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • nXqdnXqd Member Posts: 39
    Please clarify "process"
    Thanks for your reminding. I seem to post unclear thread, I will notice next time :)
  • koubekkoubek Member Posts: 84
    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.
  • nXqdnXqd Member Posts: 39
    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 ?
  • koubekkoubek Member Posts: 84
    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:
  • nXqdnXqd Member Posts: 39
    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,
    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?"
    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.
  • kinekine Member Posts: 12,562
    Example:
    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.
  • koubekkoubek Member Posts: 84
    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.
  • nXqdnXqd Member Posts: 39
    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 :)
Sign In or Register to comment.