krunal shah
krunal shah

Reputation: 16339

fetch start and end time for every job with delayed_job

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

Upvotes: 0

Views: 209

Answers (2)

Geoff Lanotte
Geoff Lanotte

Reputation: 7510

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.

Upvotes: 1

David Lyod
David Lyod

Reputation: 1438

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).

Upvotes: 0

Related Questions