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.
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
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 :)
good luck