Class: Slugrunner::Runner
- Inherits:
-
Object
- Object
- Slugrunner::Runner
- Defined in:
- lib/slugrunner/runner.rb
Instance Attribute Summary collapse
-
#bind_delay ⇒ Object
Returns the value of attribute bind_delay.
-
#extra_env ⇒ Object
Returns the value of attribute extra_env.
-
#ping_interval ⇒ Object
Returns the value of attribute ping_interval.
-
#ping_url ⇒ Object
Returns the value of attribute ping_url.
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
-
#initialize(slug, process_type, instance_number) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(slug, process_type, instance_number) ⇒ Runner
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/slugrunner/runner.rb', line 18 def initialize(slug, process_type, instance_number) @slug = slug @process_type = process_type @ping = false @bind_delay = 0 @ping_url = nil @ping_interval = 0 @alive = false @shell = false @extra_env = [] @hostname = "#{@process_type}.#{instance_number}" end |
Instance Attribute Details
#bind_delay ⇒ Object
Returns the value of attribute bind_delay.
12 13 14 |
# File 'lib/slugrunner/runner.rb', line 12 def bind_delay @bind_delay end |
#extra_env ⇒ Object
Returns the value of attribute extra_env.
16 17 18 |
# File 'lib/slugrunner/runner.rb', line 16 def extra_env @extra_env end |
#ping_interval ⇒ Object
Returns the value of attribute ping_interval.
14 15 16 |
# File 'lib/slugrunner/runner.rb', line 14 def ping_interval @ping_interval end |
#ping_url ⇒ Object
Returns the value of attribute ping_url.
13 14 15 |
# File 'lib/slugrunner/runner.rb', line 13 def ping_url @ping_url end |
#shell ⇒ Object
Returns the value of attribute shell.
15 16 17 |
# File 'lib/slugrunner/runner.rb', line 15 def shell @shell end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/slugrunner/runner.rb', line 31 def run Dir.mktmpdir do |tmpdir| logger("Scratch directory -> #{tmpdir}") @slug_dir = tmpdir @ping = true if !@ping_url.nil? && @ping_interval > 0 download_and_run return 0 end rescue => e logger("Error: #{e}") return 1 end |