Closed sabativi closed 2 years ago
Yep you can just do a query to Jobs.collection
On Tue, Nov 16, 2021 at 8:41 PM Victor Sabatier @.***> wrote:
Hello,
I just want to do a small UI where I can run jobs definining server side, is there any way to get the list of all jobs that have been registered ?
Thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/msavin/SteveJobs/issues/100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPP5A6NM37P6B23YZLMXOTUMJYCBANCNFSM5IEQKWNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
But the first time, I have not run any job so there will be nothing inside Job Collection
When I do
Jobs.register({
name1: function(){},
name2: function(){}
})
Where can I get the list [name1, name2]
?
The job is only created when you run Jobs.run
On Wed, Nov 17, 2021 at 10:22 PM Victor Sabatier @.***> wrote:
But the first time, I have not run any job so there will be nothing inside Job Collection
When I do
Jobs.register({ name1: function(){}, name2: function(){} })
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/msavin/SteveJobs/issues/100#issuecomment-971766861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPP5AYCBTANFGYP2ID7MDTUMPMUFANCNFSM5IEQKWNQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Yes I know that but when running Jobs.run(name) there must be a way to check that a job named "name" exists So there must be somewhere where you have the list of all possible jobs to be runned I do not want to know pending jobs, only list of jobs that can be run
Thanks again for your time
Here is a way to do it
import { Jobs, JobsInternal } from "meteor/msavin:sjobs";
new SecuredMethod({
name: "Jobs.list",
validate: () => {},
run() {
const manager = JobsInternal.Operator.manager;
const jobs = Object.keys(manager.queues);
return jobs;
},
});
Hello,
I just want to do a small UI where I can run jobs definining server side, is there any way to get the list of all jobs that have been registered ?
Thanks