REQ: Workflow manager MOD for ordering global job queues for crafters

Started by idgarad, November 13, 2017, 10:37:17 AM

Previous topic - Next topic

idgarad

We really need a queue manager where I can queue crafting jobs and set a max number of active jobs.

In the scenario I have between crafting robots, smokeleaf industry, etc. I'd be easier to have a central global queue that I can order on priority that will either add jobs to workstations with a limit, say 2 jobs active then as those jobs are completed then remove them or move them down to the bottom of the stack. This way if I have 2 crafters I can set the active job limit to 2. 3 crafters, 3.


e.g. (Assuming 1 crafter, with 1 job limit):


Cut Stone
Cut Smokeleaf
Make Robot Parts
Make Medicine
Smelt Slag

So in this queue, once Cut Stone is complete, either suspend or remove the job then create\unsuspend the Cut Smokeleaf job. Rinse until the last one Smelt Slag is complete. Then go back and readd or unsuspend the Cut Stone.


Proggy Stuff.

The simplest way I can see is index all the workstations that have jobs requiring Crafting and are not "Do Forever" jobs. (In short the list is built by adding bills at workstations rather then add them centrally. Either would work).

  • Build a list of all the bills they have.
  • In the workflow manager automatically suspend all the jobs.
  • Build a list of jobs with an associated priority value.
  • GUI reorder global list of jobs to adjust their GLOBAL_PRIORITY_VALUE
  • periodically based on MAX_CONCURRENT_JOBS unsuspend the highest priority jobs until they are paused that have the materials available
  • periodically check if an active job no longer has available materials, if so suspend it and move on to the next job
  • IF the job is a do forever job, based on a config suspend the job periodically time-wise to free up work for the next job in the queue
  • Once paused set a GLOBAL_JOBS_COMPLETE flag to prevent unsuspending and skip.
  • Once the last GLOBAL_JOB is completed (e.g. all entries have GLOBAL_JOBS_COMPLETE=TRUE) in the list is finished clear all the GLOBAL_JOBS_COMPLETE flags to restart the list.
  • GUI Allow manual untick of GLOBAL_JOBS_COMPLETE to force a re-queue of a job on the stack.

This brings is a bit closer to DF's method of queuing jobs independent of the workshop with some priority ordering.