class SimpleMapReduce::Server::Task

Attributes

job_id[R]
task_class_name[R]
task_input_bucket_name[R]
task_input_file_path[R]
task_output_bucket_name[R]
task_output_directory_path[R]
task_script[R]
worker[R]

Public Class Methods

deserialize(data) click to toggle source
# File lib/simple_map_reduce/server/task.rb, line 79
def deserialize(data)
  new(MessagePack.unpack(data).transform_keys(&:to_sym))
end
new(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) click to toggle source
# 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

Public Instance Methods

dump() click to toggle source
# File lib/simple_map_reduce/server/task.rb, line 74
def dump
  to_h.merge(state: state)
end
id() click to toggle source
# File lib/simple_map_reduce/server/task.rb, line 53
def id
  @id ||= SecureRandom.uuid
end
serialize() click to toggle source
# File lib/simple_map_reduce/server/task.rb, line 70
def serialize
  to_h.to_msgpack
end
to_h() click to toggle source
# 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