Class: SimpleMapReduce::Server::Task
- Inherits:
-
Object
- Object
- SimpleMapReduce::Server::Task
- Extended by:
- Forwardable
- Includes:
- AASM
- Defined in:
- lib/simple_map_reduce/server/task.rb
Instance Attribute Summary collapse
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#task_class_name ⇒ Object
readonly
Returns the value of attribute task_class_name.
-
#task_input_bucket_name ⇒ Object
readonly
Returns the value of attribute task_input_bucket_name.
-
#task_input_file_path ⇒ Object
readonly
Returns the value of attribute task_input_file_path.
-
#task_output_bucket_name ⇒ Object
readonly
Returns the value of attribute task_output_bucket_name.
-
#task_output_directory_path ⇒ Object
readonly
Returns the value of attribute task_output_directory_path.
-
#task_script ⇒ Object
readonly
Returns the value of attribute task_script.
-
#worker ⇒ Object
readonly
Returns the value of attribute worker.
Class Method Summary collapse
Instance Method Summary collapse
- #dump ⇒ Object
- #id ⇒ Object
-
#initialize(job_id:, task_class_name:, task_script:, task_input_bucket_name:, task_input_file_path:, task_output_bucket_name:, task_output_directory_path:, id: nil, worker: nil) ⇒ Task
constructor
A new instance of Task.
- #serialize ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(job_id:, task_class_name:, task_script:, task_input_bucket_name:, task_input_file_path:, task_output_bucket_name:, task_output_directory_path:, id: nil, worker: nil) ⇒ Task
Returns a new instance of Task.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/simple_map_reduce/server/task.rb', line 40 def initialize(job_id:, task_class_name:, task_script:, task_input_bucket_name:, task_input_file_path:, task_output_bucket_name:, task_output_directory_path:, id: nil, worker: nil) @id = id @job_id = job_id @task_class_name = task_class_name @task_script = task_script @task_input_bucket_name = task_input_bucket_name @task_input_file_path = task_input_file_path @task_output_bucket_name = task_output_bucket_name @task_output_directory_path = task_output_directory_path @worker = worker end |
Instance Attribute Details
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def job_id @job_id end |
#task_class_name ⇒ Object (readonly)
Returns the value of attribute task_class_name.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def task_class_name @task_class_name end |
#task_input_bucket_name ⇒ Object (readonly)
Returns the value of attribute task_input_bucket_name.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def task_input_bucket_name @task_input_bucket_name end |
#task_input_file_path ⇒ Object (readonly)
Returns the value of attribute task_input_file_path.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def task_input_file_path @task_input_file_path end |
#task_output_bucket_name ⇒ Object (readonly)
Returns the value of attribute task_output_bucket_name.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def task_output_bucket_name @task_output_bucket_name end |
#task_output_directory_path ⇒ Object (readonly)
Returns the value of attribute task_output_directory_path.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def task_output_directory_path @task_output_directory_path end |
#task_script ⇒ Object (readonly)
Returns the value of attribute task_script.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def task_script @task_script end |
#worker ⇒ Object (readonly)
Returns the value of attribute worker.
12 13 14 |
# File 'lib/simple_map_reduce/server/task.rb', line 12 def worker @worker end |
Class Method Details
.deserialize(data) ⇒ Object
79 80 81 |
# File 'lib/simple_map_reduce/server/task.rb', line 79 def deserialize(data) new(MessagePack.unpack(data).transform_keys(&:to_sym)) end |
Instance Method Details
#dump ⇒ Object
74 75 76 |
# File 'lib/simple_map_reduce/server/task.rb', line 74 def dump to_h.merge(state: state) end |
#id ⇒ Object
53 54 55 |
# File 'lib/simple_map_reduce/server/task.rb', line 53 def id @id ||= SecureRandom.uuid end |
#serialize ⇒ Object
70 71 72 |
# File 'lib/simple_map_reduce/server/task.rb', line 70 def serialize to_h.to_msgpack end |
#to_h ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/simple_map_reduce/server/task.rb', line 57 def to_h { id: id, job_id: @job_id, task_class_name: @task_class_name, task_script: @task_script, task_input_bucket_name: @task_input_bucket_name, task_input_file_path: @task_input_file_path, task_output_bucket_name: @task_output_bucket_name, task_output_directory_path: @task_output_directory_path } end |