Automattic / Automattic/kue

Running multiple jobs at once

Open
#726 1 comment 3 reactions 0 assignees View on GitHub
Discussion
Dominant language
JavaScript
Stars
9.4k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

I'm currently looking at this library and what I need is the abilitity to get jobs in chunk, so that I can process 1000 jobs at one time on one machine, and getting the list of those 1000 jobs using the process function. This way, I could run a SQL transaction that could process all those jobs at once.

However, I would still have the granularity of one job, because from the 1000 jobs I runned, I could specify which one failed and which one succeeded.

I would write something like :

``` js
queue.processChunk('email', {maxLength:1000}, function(jobs, done){
processMultipleJobs(jobs, function(err, result) {
if(err) return done(err); // Set all jobs as failed
// result.failedJobs List of failed jobs
// result.succeededJobs List of succeeded jobs
var failedJobs = result.failedJobs.map(function(j){j.failed=true; j.error=j.err; return j;})
var succeededJobs = result.failedJobs.map(function(j){j.success=true; return j;})
var allJobs = failedJobs.concat(succeededJobs);
done(allJobs);
})
});
```

I think there is no such feature in the current kue.
If there is one way to achieve that, could you point me to it ?
If not, would you be interested if I created a pull request for that change ?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading Kue's existing process function and job completion and error-handling flow. Compare that behavior with the proposed processChunk API, including per-job success and failure reporting; done should provide chunked processing while preserving individual job outcomes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, redis
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.