class BatchKit::Database::JobRun

Records details of job runs

Public Class Methods

new(job_run) click to toggle source
Calls superclass method
# File lib/batch-kit/database/models.rb, line 306
def initialize(job_run)
    super(job_id: job_run.job_id, job_instance: job_run.instance,
          job_version: job_run.job_version, job_run_by: job_run.run_by,
          job_cmd_line: job_run.cmd_line, job_start_time: job_run.start_time,
          job_status: job_run.status.to_s.upcase, job_pid: job_run.pid)
end

Public Instance Methods

job_end(job_run) click to toggle source
# File lib/batch-kit/database/models.rb, line 320
def job_end(job_run)
    self.job_end_time = job_run.end_time
    self.job_status = job_run.status.to_s.upcase
    self.job_pid = nil
    self.job_exit_code = job_run.exit_code
    self.save
end
job_start(job_run) click to toggle source
# File lib/batch-kit/database/models.rb, line 314
def job_start(job_run)
    self.save
    job_run.job_run_id = self.job_run
end
timeout() click to toggle source
# File lib/batch-kit/database/models.rb, line 329
def timeout
    self.job_end_time = Time.now
    self.job_status = 'TIMEOUT'
    self.job_pid = nil
    self.job_exit_code = -1
    self.save

    Job[self.job_id].job_timeout(self)
end