Class: Azkaban::JobFile

Inherits:
Object
  • Object
show all
Defined in:
lib/azkaban-rb/tasks.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task, ext) ⇒ JobFile

Returns a new instance of JobFile.



63
64
65
66
67
# File 'lib/azkaban-rb/tasks.rb', line 63

def initialize(task, ext)
  @task = task
  @ext = ext
  @args = {}
end

Class Attribute Details

.output_dirObject

Returns the value of attribute output_dir.



70
71
72
# File 'lib/azkaban-rb/tasks.rb', line 70

def output_dir
  @output_dir
end

Instance Method Details

#set(params) ⇒ Object



73
74
75
76
77
# File 'lib/azkaban-rb/tasks.rb', line 73

def set(params)
  params.each do |k,v|
    @args[k] = v
  end
end

#writeObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/azkaban-rb/tasks.rb', line 79

def write
  if @args.size > 0
    file_name = @task.name.gsub(":", "-") + @ext
    if @task.prerequisites.size > 0
      scope = @task.scope.map { |s| s.to_s }.join("-")
      @args["dependencies"] = @task.prerequisites.map{ |p| 
        # look up the prerequisite in the scope of its task
        prereq_task = Rake.application.lookup(p, @task.scope)
        prereq_task.name.gsub(":", "-")
      }.join(",")
    end
    create_properties_file(file_name, @args)
    puts "Created #{file_name}"
  end
end