Class: Vx::ContainerConnector::Local

Inherits:
Object
  • Object
show all
Includes:
Instrument
Defined in:
lib/vx/container_connector/local.rb,
lib/vx/container_connector/local/spawner.rb

Defined Under Namespace

Classes: Spawner

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Instrument

#instrument

Constructor Details

#initialize(options = {}) ⇒ Local

Returns a new instance of Local.


16
17
18
19
# File 'lib/vx/container_connector/local.rb', line 16

def initialize(options = {})
  @work_dir = options[:work_dir] || default_work_dir
  @work_dir = File.expand_path(@work_dir)
end

Instance Attribute Details

#work_dirObject (readonly)

Returns the value of attribute work_dir


14
15
16
# File 'lib/vx/container_connector/local.rb', line 14

def work_dir
  @work_dir
end

Instance Method Details

#start {|spawner| ... } ⇒ Object

Yields:

  • (spawner)

21
22
23
24
25
26
27
28
29
30
# File 'lib/vx/container_connector/local.rb', line 21

def start(&block)
  instrument( "start_container", container_type: 'local', container: { work_dir: work_dir }) do
    FileUtils.rm_rf(work_dir)
    FileUtils.mkdir_p(work_dir)
  end

  spawner = Spawner.new(work_dir)

  yield spawner
end