Scheduler

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Perequisites

The Prolog system Yap

Subversion (svn) to check out (DEAD LINK!) https://adempiere.svn.sourceforge.net/svnroot/adempiere/branches/adempiere350/extend/src/test/functional

HOWTO

Ensure yap is installed correctly by invoking yap within the console and the checked out directory. You should the see command prompt

  Yap version Yap-5.1.1
     ?- 

Then load rbtreetest.yap into yap. a '.' tells yap that the command ends here. You can exit yap by pressing Ctrl-c and then e. Run the example benchmark which schedules 8243 task within 40s on my 2.5 Ghz. machine


  consult('rbtreetest.yap').
  
  benchmark3(Tasks).


You can enter the same in one line

  consult('rbtreetest.yap'), benchmark3(Tasks).

On Linux you may want to pipe the output to a file which is even faster and shows how you can automate scheduling:

  time yap <<< "consult('rbtreetest.yap'), benchmark3(Tasks)." &> output

So what do you get now? You got errors.csv

  CRP001, 3, FIXME, 6, Started operation should have ended before schedule start but no complete transaction entered 
  CRP001, 4, FIXME, 3, Started operation should have ended before schedule start but no complete transaction entered 
  CRP016, 7, FIXME, 19, Operation exceeds alotted schedule 
  [...]

and you got scheduled_tasks.txt

  Name, TaskId, StartTime, FinishTime, ResourceId, NeededByTime
  0, 0, 1202832000, 1202857200, 7, 1202832000
  0, 0, 1202918400, 1202943600, 7, 1202832000
  [...]

So how to apply this all to my data?

See the first source forge link above - there is a perl script.

And - you've guessed it - look at rbtreetest.yap and search for the benchmark3 function. This should tell you everything you need?

tools

xp_rg has also written a CSVToOpenProjTest.java file for visualizing the result

perl script mentioned above

trouble shooting : no .txt file ?

Apply this patch (I hope xp_rg will commit the fix soon)

  Index: rbtreetest.yap
  ===================================================================
  --- rbtreetest.yap      (revision 4861)
  +++ rbtreetest.yap      (working copy)
  @@ -943,6 +943,7 @@
                findGoodStart(ResourceAvailableIntervalTree, ScheduledTaskTree, DepTasks, ScheduleStartTime, WcCapacityType, GoodStart)
                 ;
                findGoodStart(ResourceAvailableIntervalTree, ScheduledTaskTree, DepTasks, EST, WcCapacityType, GoodStart)
  +        )
           ),
          write('GoodStart: '),
          write(GoodStart),