Class: Elasticrawl::Job

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/elasticrawl/job.rb

Overview

The base job class that is extended by ParseJob and CombineJob.

Direct Known Subclasses

CombineJob, ParseJob

Instance Method Summary collapse

Instance Method Details

#confirm_messageObject

Displays a confirmation message showing the configuration of the Elastic MapReduce job flow and cluster.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/elasticrawl/job.rb', line 8

def confirm_message
  cluster = Cluster.new

  case self.type
  when 'Elasticrawl::ParseJob'
    message = segment_list
  else
    message = []
  end

  message.push('Job configuration')
  message.push(self.job_desc)
  message.push('')
  message.push(cluster.cluster_desc)

  message.join("\n")
end

#historyObject

Displays the history of the current job. Called by the status command.



33
34
35
36
# File 'lib/elasticrawl/job.rb', line 33

def history
  launch_time = "Launched: #{self.created_at.strftime('%Y-%m-%d %H:%M:%S')}"
  "#{self.job_name} #{launch_time} #{self.job_desc}"
end

#result_messageObject

Displays the Job Name and Elastic MapReduce Job Flow ID if the job was launched successfully.



28
29
30
# File 'lib/elasticrawl/job.rb', line 28

def result_message
  "\nJob: #{self.job_name} Job Flow ID: #{self.job_flow_id}"
end