Class: SGE::QAcct::Transformer
- Inherits:
-
Object
- Object
- SGE::QAcct::Transformer
- Defined in:
- lib/sge/qacct/transformer.rb
Instance Method Summary collapse
- #command(opts = {}) ⇒ Object
- #load_from_yaml_file(yaml_file, remove_file = false, &block) ⇒ Object
- #transformer_file ⇒ Object
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_file ⇒ Object
13 14 15 |
# File 'lib/sge/qacct/transformer.rb', line 13 def transformer_file File.('../../../../utils/transform_to_yaml.sh',__FILE__) end |