views:

22

answers:

2

Is there any way i can fetch start and time for my every job. I am using delayed_job.

A: 

delayed_job has no ability to track the start time, duration or end time of a job. It also by default removes the table entry upon success.

You would have to fork the github version to and create a patch to track and record this information or utilise an external method ( http://helderribeiro.net/?p=87 uses monit ) to track this data (again which uses a forked version).

David Lyod
+1  A: 

Depending on your setup, you could include actions to record the start time and end time of your job within the job itself.

class SomeJob < Struct.new(:param1, :param2)
  def perform
    start_time = Time.now

    ## Do Something

    SomeModel.find(id).update_parameters({:start_time => start_time, :end_time => Time.now})
  end
end

Might be easier than forking the repository and I am not crazy about the idea of keeping all of those jobs around, it would slow down the queue over time depending on load.

Geoff Lanotte