when 'in' or 'at' jobs have been triggered, they are no more in the
scheduler.all_jobs list.
But I need to keep track of running jobs.
I got some clues on this on IRC thanks to jmettraux, and I came up
with a one line patch on lib/rufus/sc/jobs.rb :
--- jobs.rb 2011-12-19 18:09:40.661879170 +0100
+++ jobs-new.rb 2011-12-19 18:09:05.430878139 +0100
@@ -177,6 +177,7 @@
# (Only jobs know about this method of the scheduler)
job_thread = Thread.current
+ job_thread['jid'] = @params[:tags]
job_thread[
"rufus_scheduler__trigger_thread__#{@scheduler.object_id}"
] = true
So running threads can be tagged like jobs.
Then I can identify my threads with :
Thread.list.each { |th| puts th['jid'] }
So I have 2 questions :
- is it clean (I am very new to rufus-scheduler and may be I'm
naive) ?
- could you consider having it (or a better approach) mainstream ?
Let me know, thanks in advance.
Louis Coilliot
Hello Louis,
after considering your patch I noticed that I had already implemented that
thing:
So I decided to 'upgrade' it a bit and I added a Scheduler#running_jobs
method:
https://github.com/jmettraux/rufus-scheduler/commit/abc192e1f48c87191242be90cc1f10def73760f4
I hope it will help, sorry not to have realized immediately.
Please tell me if you need a release of the gem that includes this new
feature.
Thanks and best regards,
--
John Mettraux - http://lambda.io/processi
I can easily create an external find_by_tag method on it.
Yes, it would be great to have a new gem with it, if that's not much
work for you.
It would definitely simplify my docs and procedures.
Louis Coilliot
2011/12/20 John Mettraux <jmet...@gmail.com>:
> --
> you received this message because you are subscribed to the "rufus ruby" group.
> to post : send email to rufus...@googlegroups.com
> to unsubscribe : send email to rufus-ruby+...@googlegroups.com
> more options : http://groups.google.com/group/rufus-ruby?hl=en
Hello,
rufus-scheduler 2.0.15 is out.
Cheers,
Hello Louis,
maybe this can help with EmScheduler#running_jobs:
https://github.com/jmettraux/rufus-scheduler/commit/644dbc74f3a5fd0387a39a10abad63ba11feb1b4
Cheers,
John