Closed openqubit closed 8 years ago
Hi, no. Job-collection does not inspect the job data
for any purpose. The mechanism provided for determining which jobs to run first is to use the job.priority()
setting. You can set (and change) the priority based on any criteria you might want to apply. It is completely general.
The alternative (allowing arbitrarily complex and changing rules to determine job priority) would be extremely inefficient because it would be difficult to index the database effectively. It would also be error prone, because corner cases would enter the priority scheme (what happens if there is no approvalStatus
, or if it isn't a known value or even a string?)
The solution is to work out a mapping of the relevant data states to an integer priority value (0 is normal, negative values run sooner, positive values run later). Job-collection will respect that priority value when choosing which jobs to assign to workers, and it will do so efficiently because the lookup is fully indexed within the database.
Thank you for your elaborate answer. That answered the questions i was having.
I am looking at this sample code for doing a sample job
At this point
var email = job.data; // Only one email per job
where the worker is acquiring a job,can we pass a parameter to tell the worker to only pick jobs where say, approval status is approvedapprovalstatus: "approved"
or status = 1 for instance?.The status or approvalstatus shall be stored alongside other job data like