Sha256: eae0515bc326a1cc5bd4441954955ac8a92baa51be2cb3d06e3414cd9fc3c1b0

Contents?: true

Size: 1.39 KB

Versions: 155

Compression:

Stored size: 1.39 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.exist?(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, "Directory: ") + directory if directory
puts Log.color(:magenta, "Step path: ") + step_path if step_path

HPC::BATCH_MODULE.follow_job directory, true

Version data entries

155 entries across 49 versions & 1 rubygems

Version Path
rbbt-util-5.44.1 share/rbbt_commands/hpc/tail
rbbt-util-5.44.1 share/rbbt_commands/lsf/tail
rbbt-util-5.44.1 share/rbbt_commands/pbs/tail
rbbt-util-5.44.1 share/rbbt_commands/slurm/tail
rbbt-util-5.43.0 share/rbbt_commands/pbs/tail
rbbt-util-5.43.0 share/rbbt_commands/hpc/tail
rbbt-util-5.43.0 share/rbbt_commands/slurm/tail
rbbt-util-5.43.0 share/rbbt_commands/lsf/tail
rbbt-util-5.42.0 share/rbbt_commands/lsf/tail
rbbt-util-5.42.0 share/rbbt_commands/pbs/tail
rbbt-util-5.42.0 share/rbbt_commands/slurm/tail
rbbt-util-5.42.0 share/rbbt_commands/hpc/tail
rbbt-util-5.41.1 share/rbbt_commands/lsf/tail
rbbt-util-5.41.1 share/rbbt_commands/pbs/tail
rbbt-util-5.41.1 share/rbbt_commands/hpc/tail
rbbt-util-5.41.1 share/rbbt_commands/slurm/tail
rbbt-util-5.41.0 share/rbbt_commands/hpc/tail
rbbt-util-5.41.0 share/rbbt_commands/pbs/tail
rbbt-util-5.41.0 share/rbbt_commands/slurm/tail
rbbt-util-5.41.0 share/rbbt_commands/lsf/tail