kue icon indicating copy to clipboard operation
kue copied to clipboard

Search active jobs

Open btmdave opened this issue 10 years ago • 8 comments

I see that with the UI there's /job/search?q= to perform a search on data properties within a job. But is there a method within kue or api to search and by active? For example, something like this would be very useful.

queue.search({status: 'active', data: {key : 'something', anotherkey : 'somethingelse'}})

btmdave avatar May 06 '15 14:05 btmdave

indexes are currently blinded created from the job.data. That can be a feature to index also job states... low priority until we get to an stable search index

behrad avatar May 06 '15 17:05 behrad

+1 for being able to find jobs by data.

bobmoff avatar Jul 22 '15 19:07 bobmoff

you currently can search job data ( even define which fields to index) if you disableSearch: false, please read the related section of README @bobmoff

behrad avatar Jul 23 '15 12:07 behrad

sorry for not being clear. i ment like @btmdave was suggesting. through the queue object.

the search you are talking about is through the express http api right ?

bobmoff avatar Jul 23 '15 14:07 bobmoff

Just to re-iterate the use case, we don't generally use the kue ui, so as-is, there's no way to perform a search. I can get active jobs using kue.jobs.active or complete jobs with kue.jobs.complete etc. The only missing piece would be a kue.jobs.search, which for that we've had to run kue ui and make an http request to the api to /job/search?q=

btmdave avatar Jul 23 '15 14:07 btmdave

you can create a PR adding a search method to Queue object like https://github.com/Automattic/kue/blob/master/lib/http/routes/json.js#L269

behrad avatar Jul 23 '15 16:07 behrad

+1 on searching on data.

I only ever have to search based on one specific key in my data structure, so might be able to work around it by only having that key in searchKeys.

Not very pretty though.

If I have a key in my data which is consistent, is there another way of finding jobs based on that key? Considering looping through all jobs to achieve it.

KATT avatar Aug 27 '15 16:08 KATT

I wrote an article that might help solving this issue: https://medium.com/@sanchitbansal10/search-kue-jobs-by-job-data-c33972c04c6c

sanchitbansal10 avatar Mar 13 '19 10:03 sanchitbansal10