Class: Azkaban::JobFile
- Inherits:
-
Object
- Object
- Azkaban::JobFile
- Defined in:
- lib/azkaban-rb/tasks.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.output_dir ⇒ Object
Returns the value of attribute output_dir.
Instance Attribute Summary collapse
-
#read_locks ⇒ Object
readonly
Returns the value of attribute read_locks.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
-
#uses_arg ⇒ Object
readonly
Returns the value of attribute uses_arg.
-
#write_locks ⇒ Object
readonly
Returns the value of attribute write_locks.
Instance Method Summary collapse
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
-
#initialize(task, ext) ⇒ JobFile
constructor
A new instance of JobFile.
- #reads(name, *options) ⇒ Object
- #set(params) ⇒ Object
- #write ⇒ Object
- #writes(name, *options) ⇒ Object
Constructor Details
#initialize(task, ext) ⇒ JobFile
Returns a new instance of JobFile.
70 71 72 73 74 75 76 77 |
# File 'lib/azkaban-rb/tasks.rb', line 70 def initialize(task, ext) task.job = self @task = task @ext = ext @args = {} @read_locks = [] @write_locks = [] end |
Class Attribute Details
.output_dir ⇒ Object
Returns the value of attribute output_dir.
80 81 82 |
# File 'lib/azkaban-rb/tasks.rb', line 80 def output_dir @output_dir end |
Instance Attribute Details
#read_locks ⇒ Object (readonly)
Returns the value of attribute read_locks.
66 67 68 |
# File 'lib/azkaban-rb/tasks.rb', line 66 def read_locks @read_locks end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
66 67 68 |
# File 'lib/azkaban-rb/tasks.rb', line 66 def task @task end |
#uses_arg ⇒ Object (readonly)
Returns the value of attribute uses_arg.
66 67 68 |
# File 'lib/azkaban-rb/tasks.rb', line 66 def uses_arg @uses_arg end |
#write_locks ⇒ Object (readonly)
Returns the value of attribute write_locks.
66 67 68 |
# File 'lib/azkaban-rb/tasks.rb', line 66 def write_locks @write_locks end |
Instance Method Details
#[](k) ⇒ Object
83 84 85 |
# File 'lib/azkaban-rb/tasks.rb', line 83 def [](k) @args[k] end |
#[]=(k, v) ⇒ Object
87 88 89 |
# File 'lib/azkaban-rb/tasks.rb', line 87 def []=(k,v) @args[k] = v end |
#reads(name, *options) ⇒ Object
97 98 99 100 |
# File 'lib/azkaban-rb/tasks.rb', line 97 def reads(name, *) @read_locks << name (, name) end |
#set(params) ⇒ Object
91 92 93 94 95 |
# File 'lib/azkaban-rb/tasks.rb', line 91 def set(params) params.each do |k,v| @args[k] = v end end |
#write ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/azkaban-rb/tasks.rb', line 107 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 |
#writes(name, *options) ⇒ Object
102 103 104 105 |
# File 'lib/azkaban-rb/tasks.rb', line 102 def writes(name, *) @write_locks << name (, name) end |