class EvJobGen::Job

Constants

CHARS

Attributes

command[R]
commithash[R]
image[R]
metrics[R]
namespace[R]
out[R]
setup_wget[R]
suffix[R]

Public Class Methods

new(yml_file) click to toggle source
# File lib/ev_job_gen/job.rb, line 7
def initialize(yml_file)
  h = YAML.load_file(yml_file)
  validate!(h)
  @namespace  = h["namespace"]
  @image      = h["image"]
  @command    = h["command"]
  @out        = h["out"]
  @metrics    = h["metrics"]
  @commithash = h["commithash"]
  @setup_wget = h["setup_wget"]  # NOTE: this is optional

  # NOTE: suffix is used only for oneshot job
  @suffix    = 5.times.map { CHARS.sample }.join
end

Public Instance Methods

validate!(h) click to toggle source
# File lib/ev_job_gen/job.rb, line 35
def validate!(h)
  validate_column!(h, "namespace")
  validate_column!(h, "image")
  validate_column!(h, "command")
  validate_column!(h, "out")
  validate_column!(h, "metrics")
  validate_column!(h, "commithash")
end
validate_column!(h, column) click to toggle source
# File lib/ev_job_gen/job.rb, line 44
def validate_column!(h, column)
  if !h[column]
    raise "#{column} must be specified, but got #{h[column]}"
  end
end