Kue: Is it Possible to retrieve all jobs (in kue)?

Created on 17 Feb 2016  路  8Comments  路  Source: Automattic/kue

Hi, I want to know, if its possible to get (list) of all jobs in kue (queue). When adding new task as job, I want to check if it's already there in queue.. I amn't able to figure out function.. Though peoples have answered that question on forums to get the job by Id but in my case i don't know job Id at the state?

Thanks.

Question

Most helpful comment

I faced same problem here, and I did not find a way in the documantation, but after giving a little scan of the code I discovered, there is a method called range :)

kue.Job.range(0, -1, 'desc', (err, jobs) => {
// do whatever you want with all jobs ;)
});

good luck

All 8 comments

Check https://github.com/Automattic/kue#programmatic-job-management if it solves your problem

@behrad thanks for link, As I've read the whole documentation too, but the api includes methods to filter jobs by state, jobID and range (i.e., the section you referred to me). As, I want to know is there any other way or defined method/function (a single function call) through which i may able to get all jobs in queue. i.e., array (complete, inactive, active, etc)?

Thanks.

No, You can iterate over all states (inactive, active, complete, failed, delayed) :)

Ok, Thanks.

Is there away to query on jobs that are missing the state field?

I faced same problem here, and I did not find a way in the documantation, but after giving a little scan of the code I discovered, there is a method called range :)

kue.Job.range(0, -1, 'desc', (err, jobs) => {
// do whatever you want with all jobs ;)
});

good luck

Can you please update docs in a PR?

Can I get a event that all jobs in a Q are complete

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mogadanez picture mogadanez  路  3Comments

adriano-di-giovanni picture adriano-di-giovanni  路  9Comments

shriramshankar picture shriramshankar  路  8Comments

jbrooksuk picture jbrooksuk  路  3Comments

CMCDragonkai picture CMCDragonkai  路  4Comments