Class: Oxidized::Job
- Inherits:
 - 
      Thread
      
        
- Object
 - Thread
 - Oxidized::Job
 
 
- Includes:
 - SemanticLogger::Loggable
 
- Defined in:
 - lib/oxidized/job.rb
 
Instance Attribute Summary collapse
- 
  
    
      #config  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute config.
 - 
  
    
      #end  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute end.
 - 
  
    
      #node  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute node.
 - 
  
    
      #start  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute start.
 - 
  
    
      #status  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute status.
 - 
  
    
      #time  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute time.
 
Instance Method Summary collapse
- 
  
    
      #initialize(node)  ⇒ Job 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Job.
 
Constructor Details
#initialize(node) ⇒ Job
Returns a new instance of Job.
      7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  | 
    
      # File 'lib/oxidized/job.rb', line 7 def initialize(node) @node = node @start = Time.now.utc self.name = "Job '#{@node.name}'" super do logger.debug "Starting fetching process for #{@node.name}" begin Timeout.timeout(Oxidized.config.timelimit) do @status, @config = @node.run end logger.debug "Config fetched for #{@node.name}" rescue Timeout::Error logger.warn "Job timelimit reached for #{@node.name}" @status = :timelimit ensure @end = Time.now.utc @time = @end - @start end end end  | 
  
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
      5 6 7  | 
    
      # File 'lib/oxidized/job.rb', line 5 def config @config end  | 
  
#end ⇒ Object (readonly)
Returns the value of attribute end.
      5 6 7  | 
    
      # File 'lib/oxidized/job.rb', line 5 def end @end end  | 
  
#node ⇒ Object (readonly)
Returns the value of attribute node.
      5 6 7  | 
    
      # File 'lib/oxidized/job.rb', line 5 def node @node end  | 
  
#start ⇒ Object (readonly)
Returns the value of attribute start.
      5 6 7  | 
    
      # File 'lib/oxidized/job.rb', line 5 def start @start end  | 
  
#status ⇒ Object (readonly)
Returns the value of attribute status.
      5 6 7  | 
    
      # File 'lib/oxidized/job.rb', line 5 def status @status end  | 
  
#time ⇒ Object (readonly)
Returns the value of attribute time.
      5 6 7  | 
    
      # File 'lib/oxidized/job.rb', line 5 def time @time end  |