Class: SGE::QAcct::Transformer

Inherits:
Object
  • Object
show all
Defined in:
lib/sge/qacct/transformer.rb

Instance Method Summary collapse

Instance Method Details

#command(opts = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/sge/qacct/transformer.rb', line 17

def command(opts = {})
  file = opts[:file].to_s.strip
  if file.empty?
    raise "We need a file to dump the yaml"
  end
  cmd = opts[:cmd] || "echo"
  cmd << " | #{transformer_file} > #{file}"
  cmd << " &" unless opts[:blocking]
  cmd
end

#load_from_yaml_file(yaml_file, remove_file = false, &block) ⇒ Object



6
7
8
9
10
11
# File 'lib/sge/qacct/transformer.rb', line 6

def load_from_yaml_file(yaml_file, remove_file = false,&block)
  raise "A block must be given" unless block_given?
  SGE::Utils.read_file(yaml_file,remove_file) do |file|
    YAML.load_documents(file,&block)
  end
end

#transformer_fileObject



13
14
15
# File 'lib/sge/qacct/transformer.rb', line 13

def transformer_file
  File.expand_path('../../../../utils/transform_to_yaml.sh',__FILE__)
end