Hi,
On Nov 14, 2007 5:29 AM, H H <[EMAIL PROTECTED]> wrote:
>
> I love the implementation of the tag which leads me to another
> question -- is there a way to receive job scheduling information from
> the job object?
>
> For example, if I retrieve all jobs tagged as "backup" -- it would be
> useful to know the scheduling information for each "backup" job.
jobs = scheduler.find_jobs "backup"
jobs.each do |job|
if job.kind_of?(AtJob)
puts Time.at(job.at)
else
puts jobs.cron_line.to_a.inspect
end
After your request, I worked at enhancing the rdocumentation of the
job classes :
http://openwferu.rubyforge.org/rdoc/classes/OpenWFE/Job.html
http://openwferu.rubyforge.org/rdoc/classes/OpenWFE/AtJob.html
http://openwferu.rubyforge.org/rdoc/classes/OpenWFE/CronJob.html
http://openwferu.rubyforge.org/rdoc/classes/OpenWFE/EveryJob.html
I also added an "original" attribute accessor to CronLine
http://openwferu.rubyforge.org/rdoc/classes/OpenWFE/CronLine.html
so that you'll be able to do
puts cron_job.cron_line.original
=> "60/3 * * * *"
I'm thinking about adding a "schedule_info" method that would return a
Time object for AtJob instances and the CronLine.original for CronJob.
It would make the first code example look like :
jobs = scheduler.find_jobs "backup"
jobs.each do |job|
puts job.schedule_info.to_s
end
> One approach could be to save the scheduling information to a
> database, tied to a job_id. This would work fine for jobs which are
> scheduled at an interval, but for jobs which run once -- you would
> have to manage synchronization of job status with a separate store to
> have an up-to-date list of jobs and their scheduled times (as well as
> frequency). So after a job is run, you would have to update the
> separate datastore to no longer show that job in the future schedule.
>
> Fears aside in making the scheduler a bloated mess - what are people's
> thoughts?
I'm trying to avoid persistence implementation for the scheduler for
now, I let people reschedule at restart time with their own
implementations.
My main usage of the Scheduler is within OpenWFEru (the workflow
engine), where schedules persistence is handled by the engine and not
the scheduler.
> One more thing - what about allow users to read all tags for jobs. So
> if you retrieved all jobs with a tag of "sunday", you could also view
> the other tags on that same job (e.g. "backup" in the example"). This
> would allow you to do things like store comments or other pieces of
> information into the tags :-)
puts job.tags.inspect
should do it.
Thanks for the feedback, I hope this will help, best regards,
--
John Mettraux -///- http://jmettraux.openwfe.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenWFEru users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/openwferu-users?hl=en
-~----------~----~----~----~------~----~------~--~---