Class: Cassandra::Utils::CLI::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cassandra/utils/cli/base.rb

Direct Known Subclasses

Stats::Cleanup, Stats::Compaction, Stats::Health

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



7
8
9
# File 'lib/cassandra/utils/cli/base.rb', line 7

def command
  @command
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



7
8
9
# File 'lib/cassandra/utils/cli/base.rb', line 7

def stdout
  @stdout
end

Instance Method Details

#cwdObject



9
10
11
# File 'lib/cassandra/utils/cli/base.rb', line 9

def cwd
  '/tmp'
end

#outputObject

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/cassandra/utils/cli/base.rb', line 21

def output
  raise NotImplementedError, 'Must implement this in a subclass'
end

#run!Object



25
26
27
28
29
30
31
32
# File 'lib/cassandra/utils/cli/base.rb', line 25

def run!
  runner
  @command.run!
  @stdout = @command.stdout
  out = output
  Utils::Statsd.new(metric_name).to_dd(out).push!
  out
end

#runnerObject



17
18
19
# File 'lib/cassandra/utils/cli/base.rb', line 17

def runner
  @command ||= DaemonRunner::ShellOut.new(command: command, cwd: cwd, timeout: timeout)
end

#timeoutObject



13
14
15
# File 'lib/cassandra/utils/cli/base.rb', line 13

def timeout
  300
end