lib/osc_machete_rails/statusable.rb
def job=(new_job)
      if self.has_attribute?(:job_cache)
        self.script = new_job.script_path.to_s
        self.pbsid = new_job.pbsid
        self.host = new_job.host if new_job.respond_to?(:host)
      else
        self.script_name = new_job.script_name
        self.job_path = new_job.path.to_s
        self.pbsid = new_job.pbsid
      end

      begin
        self.status = new_job.status
      rescue PBS::Error => e
        # a safe default
        self.status = OSC::Machete::Status.queued

        # log the error
        Rails.logger.error("After submitting the job with pbsid: #{pbsid}," \
                           " checking the status raised a PBS::Error: #{e.message}")
      end
    end
def job=(new_job)
      if self.has_attribute?(:job_cache)
        self.script = new_job.script_path.to_s
        self.pbsid = new_job.pbsid
        self.host = new_job.host if new_job.respond_to?(:host)
      else
        self.script_name = new_job.script_name
        self.job_path = new_job.path.to_s
        self.pbsid = new_job.pbsid
      end

      begin
        self.status = new_job.status
      rescue PBS::Error => e
        # a safe default
        self.status = OSC::Machete::Status.queued

        # log the error
        Rails.logger.error("After submitting the job with pbsid: #{pbsid}," \
                           " checking the status raised a PBS::Error: #{e.message}")
      end
    end
Setter that accepts an OSC::Machete::Job instance

 @param [Job] new_job The Job object to be assigned to the Statusable instance.