Class: Cosmos::ProcessManagerProcess

Inherits:
OperatorProcess show all
Defined in:
lib/cosmos/utilities/process_manager.rb

Instance Attribute Summary collapse

Attributes inherited from OperatorProcess

#env, #new_temp_dir, #process_definition, #scope, #temp_dir, #work_dir

Instance Method Summary collapse

Methods inherited from OperatorProcess

#alive?, #exit_code, #extract_output, #hard_stop, setup, #soft_stop, #stderr, #stdout

Constructor Details

#initialize(cmd_array, process_type, detail, expires_at, **kw_args) ⇒ ProcessManagerProcess

Returns a new instance of ProcessManagerProcess.



33
34
35
36
37
38
39
# File 'lib/cosmos/utilities/process_manager.rb', line 33

def initialize(cmd_array, process_type, detail, expires_at, **kw_args)
  super(cmd_array, **kw_args)
  @process_type = process_type
  @detail = detail
  @expires_at = expires_at
  @status = nil
end

Instance Attribute Details

#detailObject

Returns the value of attribute detail.



29
30
31
# File 'lib/cosmos/utilities/process_manager.rb', line 29

def detail
  @detail
end

#expires_atObject

Returns the value of attribute expires_at.



30
31
32
# File 'lib/cosmos/utilities/process_manager.rb', line 30

def expires_at
  @expires_at
end

#process_typeObject

Returns the value of attribute process_type.



28
29
30
# File 'lib/cosmos/utilities/process_manager.rb', line 28

def process_type
  @process_type
end

#statusObject

Returns the value of attribute status.



31
32
33
# File 'lib/cosmos/utilities/process_manager.rb', line 31

def status
  @status
end

Instance Method Details

#startObject



41
42
43
44
45
46
47
# File 'lib/cosmos/utilities/process_manager.rb', line 41

def start
  super()
  if @process
    @status = ProcessStatusModel.new(name: "#{Socket.gethostname}__#{@process.pid}", process_type: @process_type, detail: @detail, state: "Running", scope: @scope)
    @status.create
  end
end