Job Queue Category in NAV 2017

Hello,

with NAV 2017 the job queue handling is differing to NAV 2016.
In NAV 2016 I was able to manage with the job queue category which NAS should run which job queue entries.

In Nav 2017 I can define also define the job queue category but for what reason?

Answers

  • Ettu_BruteEttu_Brute Posts: 8Member
    Hi

    Like you I came to the conclusion that the category does an
  • Ettu_BruteEttu_Brute Posts: 8Member
    edited 2017-05-23
    Oh, this is interesting. Half of my reply is missing....

    As far as I can tell the Category doesn't do anything. You can't control anymore where your job queue entries are run. If you have more than one service tier with "Enable Task Scheduler" option ticked your job queue entries can be run in any of the service tiers.
  • danlindstromdanlindstrom Posts: 126Member
    if you have two (or more) job queue entries with the same category they will never be executed at the same time. if one entry is active and the next are scheduled to start before the first is ready, the second entry will be re-scheduled to a later time (random witin 3 sec)

    Dan
    Regards
    Dan Lindström
    NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
    MBSP Developer for Microsoft Dynamics NAV 2009
  • emerikspemeriksp Posts: 8Member
    Hi all,
    I have found this discussion thread, and also the last comment on https://robertostefanettinavblog.com/2016/11/04/nav-2017-task-scheduler/ mentioning the same thing:

    Job Queue Entries within the same Job Queue Category are executed serially, in other terms, one entry will not start before the previous job within the same category has completed, even if "Max. concurrent running tasks" is set to >1 and several TS Enabled services exist.

    So I believe this is true. But I can't find any official MS documentation confirming it. Do you have knowledge about where to find such documentation?

    Is it true also for NAV 2017 CU1. The customer is stuck with this version, and an upgrade is not an option (for now).
  • mgnmgn Posts: 37Member
    But how to always run Jobs after each other (serial) in the same order?
    ‘Solving’ the locking issue with the Category Code is nice. I was also expecting that I could create some Job Queue Entries that always run in the same order. I want to setup a series of jobs that run directly after each other and always in the same order. Unfortunately that doesn’t work (NAV2018cu4). I did the following test.
    Imagine a situation where you first want job 1. to prepare data, job 2. to do something with it, job 3 to do some more and job 4. to finish it off. The jobs are separate (or the same) reports and the user has to be able to set the filters (with the beautiful option Report Request Page). And I prefer not to create 1 custom codeunit with ‘fixed’ filters to be scheduled in the Job Queue.
    I created a job that takes 3-4 minutes each time (just use the SLEEP function). Then I created 4 Job Queue entries with 1 minute in between. I made sure that both ‘Starting Time’ and ‘Earliest Start Date/Time’ where at 1 minute intervals. The result was that the Jobs ran after each other, but not in the order I expected. Job 1 was always run as first, but the second, third and fourth job seemed randomly chosen. I did several tests and watched the result in the table Job Queue Log Entry.
    After having a look at the code, I think that the dispatcher (Codeunit 448) is checking if a Job can be run (based on ‘Earliest Start Date/Time’). If that is true, but another Job (with the same category) is still running, that a new Scheduled Task (table 2000000175) is created by function: Reschedule (in codeunit 448). And this function has the following line of code:
    "Earliest Start Date/Time" := CURRENTDATETIME + 2000 + RANDOM(5000);
    In this way my setup with jobs 1, 2, 3 and 4 with 1 minute interval, will seldomly be run in the order I want to. Of course I setup the jobs with a larger interval, the maximum duration I expect each can last. But that is not what I want. I just want to have job 2 start directly after job 1 has finished, then job 3 and as last job 4.
  • tiagoveigatiagoveiga Posts: 10Member
    Hi all,

    I'm having the same problem as MGN described (NAV 2018)!

    did you find any solution for this problem?

    will Job queue priority solve this? I could create task 1 with priority 1000, task 2 with priority 2000...., task 3 with priority 3000...

    Thanks,
    regards,
    Tiago Veiga
  • mgnmgn Posts: 37Member
    Hi Tiago,
    A 'workaround' could be to only have max. 1 running task at the same time. Check the setting 'Maximum Concurrent Running Tasks' in the Service settings. The default value is 10, change this 1.
    Another option could be programming a codeunit that runs the jobs after each other.
Sign In or Register to comment.