Class: Crusher::CrushSession

Inherits:
Object
  • Object
show all
Defined in:
lib/crusher/crush_session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, scenario, options = {}) ⇒ CrushSession

Returns a new instance of CrushSession.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/crusher/crush_session.rb', line 6

def initialize(target, scenario, options = {})
  @target = target
  @scenario = scenario
  @queued_jobs = []
  @running_jobs = []
  @options = options
  @current_phase = "booting"
  
  @scenario.launch_jobs.each do |job|
    job_id = 0
    puts job.keys.inspect
    puts "Launching #{job[:count]} #{job[:type]}(s)..."
    job[:count].times do
      queue_job(job, job_id)
      job_id += 1
    end
  end

  launch_queued_jobs
  
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



4
5
6
# File 'lib/crusher/crush_session.rb', line 4

def logger
  @logger
end

#scenarioObject (readonly)

Returns the value of attribute scenario.



4
5
6
# File 'lib/crusher/crush_session.rb', line 4

def scenario
  @scenario
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/crusher/crush_session.rb', line 4

def target
  @target
end

Instance Method Details

#log(message) ⇒ Object



28
29
30
31
32
# File 'lib/crusher/crush_session.rb', line 28

def log(message)
  log_message = @current_phase + ' ' +  message
  @logger.info log_message
  nil
end