Sha256: 42d7e3811fbf26b24cdae5557d903dcd8edd977f89abfbbdae99a5ce0fa257fc

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 KB

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/util/simpleopt'
require 'rbbt/hpc'

#$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF

Queue a job in Marenostrum

$ rbbt slurm tail <directory|jobid> [options] 

-h--help Print this help
EOF

if options[:help]
 if defined? rbbt_usage
  rbbt_usage 
 else
  puts SOPT.doc
 end
 exit 0
end

batch_system = options.delete :batch_system
batch_system ||= 'auto'

HPC::BATCH_MODULE = HPC.batch_system batch_system

raise ParameterException.new("Could not detect batch_system: #{Misc.fingerprint batch_system}") if HPC::BATCH_MODULE.nil?

directory = ARGV.shift

raise ParameterException if directory.nil?

if directory =~ /^[0-9]*$/
  workdir = File.expand_path('~/rbbt-batch')
  Path.setup(workdir)

  workdir.glob("**/job.id").each do |file|
    next unless directory == Open.read(file).strip
    directory = File.dirname(file)
    break
  end
end

raise ParameterException, "Could not identify job #{directory}" unless File.exists?(directory)

require 'rbbt/hpc/slurm'

command_txt = Open.read(File.join(directory, 'command.batch'))
if m = command_txt.match(/#STEP_PATH: (.*)/)
  step_path = m[1]
else
  step_path = nil
end

puts Log.color(:magenta, "Step path: ") + step_path if step_path

HPC::BATCH_MODULE.follow_job directory, true

Version data entries

15 entries across 5 versions & 1 rubygems

Version Path
rbbt-util-5.33.9 share/rbbt_commands/slurm/tail
rbbt-util-5.33.9 share/rbbt_commands/lsf/tail
rbbt-util-5.33.9 share/rbbt_commands/hpc/tail
rbbt-util-5.33.8 share/rbbt_commands/hpc/tail
rbbt-util-5.33.8 share/rbbt_commands/slurm/tail
rbbt-util-5.33.8 share/rbbt_commands/lsf/tail
rbbt-util-5.33.7 share/rbbt_commands/lsf/tail
rbbt-util-5.33.7 share/rbbt_commands/hpc/tail
rbbt-util-5.33.7 share/rbbt_commands/slurm/tail
rbbt-util-5.33.6 share/rbbt_commands/slurm/tail
rbbt-util-5.33.6 share/rbbt_commands/lsf/tail
rbbt-util-5.33.6 share/rbbt_commands/hpc/tail
rbbt-util-5.33.5 share/rbbt_commands/hpc/tail
rbbt-util-5.33.5 share/rbbt_commands/slurm/tail
rbbt-util-5.33.5 share/rbbt_commands/lsf/tail