Sha256: 0156a2eb864d91118868b57e92dd89bfc53bb5cf213191327b98e6421afcb99d

Contents?: true

Size: 1.26 KB

Versions: 28

Compression:

Stored size: 1.26 KB

Contents

#!/usr/bin/env ruby

require 'rbbt/workflow'

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

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

options = SOPT.setup <<EOF
Examine the info of a job result

$ rbbt workflow info <job-result> <key> <value>

-h--help Help
-f--force Write info even if key is already present
-r--recursive Write info for all dependencies as well
-p--check_pid Check that recursive jobs where created by the same process
EOF

SOPT.usage if options[:help]

file, key, value = ARGV

force, recursive, check_pid = options.values_at :force, :recursive, :check_pid

def get_step(file)
  file = file.sub(/\.(info|files)/,'')
  step = Workflow.load_step file
  step
end

raise ParameterException if key.nil? || value.nil?

if %w(DELETE nil).include? value
  value = nil
  force = true
end

step = get_step file

step.set_info key, value if force || ! step.info.include?(key)

pid = step.info[:pid]
host = step.info[:pid_hostname]

step.rec_dependencies.each do |dep|
  dep.set_info key, value if (force || ! dep.info.include?(key)) && (!check_pid || dep.info[:pid].to_s == pid and dep.info[:pid_hostname] == host)
rescue
  Log.warn "Could no set info #{key} for #{dep.path}: #{$!.message}"
end if recursive

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rbbt-util-5.31.14 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.13 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.12 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.11 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.10 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.9 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.8 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.7 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.5 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.4 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.3 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.2 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.1 share/rbbt_commands/workflow/write_info
rbbt-util-5.31.0 share/rbbt_commands/workflow/write_info
rbbt-util-5.30.13 share/rbbt_commands/workflow/write_info
rbbt-util-5.30.12 share/rbbt_commands/workflow/write_info
rbbt-util-5.30.11 share/rbbt_commands/workflow/write_info
rbbt-util-5.30.10 share/rbbt_commands/workflow/write_info
rbbt-util-5.30.9 share/rbbt_commands/workflow/write_info
rbbt-util-5.30.8 share/rbbt_commands/workflow/write_info