Class: Chimp::ExecRightScript

Inherits:
Executor
  • Object
show all
Defined in:
lib/right_chimp/exec/exec_rightscript.rb

Overview

Class that describes the execution for a rightscript

Constant Summary

Constants inherited from Executor

Chimp::Executor::STATUS_DONE, Chimp::Executor::STATUS_ERROR, Chimp::Executor::STATUS_HOLDING, Chimp::Executor::STATUS_NONE, Chimp::Executor::STATUS_RETRYING, Chimp::Executor::STATUS_RUNNING

Instance Attribute Summary collapse

Attributes inherited from Executor

#array, #concurrency, #delay, #dry_run, #error, #exec, #group, #inputs, #job_id, #job_notes, #job_uuid, #owner, #quiet, #results, #retry_count, #retry_sleep, #server, #status, #template, #time_end, #time_start, #timeout, #verbose

Instance Method Summary collapse

Methods inherited from Executor

#cancel, #get_total_exec_time, #initialize, #queue, #requeue

Constructor Details

This class inherits a constructor from Chimp::Executor

Instance Attribute Details

#audit_entry_dataObject

Returns the value of attribute audit_entry_data.



7
8
9
# File 'lib/right_chimp/exec/exec_rightscript.rb', line 7

def audit_entry_data
  @audit_entry_data
end

#audit_entry_urlObject

Returns the value of attribute audit_entry_url.



7
8
9
# File 'lib/right_chimp/exec/exec_rightscript.rb', line 7

def audit_entry_url
  @audit_entry_url
end

Instance Method Details

#describe_workObject



28
29
30
# File 'lib/right_chimp/exec/exec_rightscript.rb', line 28

def describe_work
  "[#{@job_uuid}] ExecRightScript job_id=#{@job_id} script=\"#{@exec.params['right_script']['name']}\" server=\"#{@server.nickname}\""
end

#infoObject



32
33
34
# File 'lib/right_chimp/exec/exec_rightscript.rb', line 32

def info
  @exec.params['right_script']['name']
end

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/right_chimp/exec/exec_rightscript.rb', line 9

def run
  options = { ignore_lock: true }.merge(@inputs)

  if @timeout < 300
    Log.error 'timeout was less than 5 minutes! resetting to 5 minutes'
    @timeout = 300
  end

  run_with_retry do
    task = Task.new
    task.tasker = @server.run_executable(@exec, options)
    @audit_entry_url = task.friendly_url
    task.wait_for_state('completed', @timeout)

    @results = task.state
    @audit_entry_data = task.details
  end
end

#targetObject



36
37
38
# File 'lib/right_chimp/exec/exec_rightscript.rb', line 36

def target
  @server.nickname
end