Class: Mutant::Parallel::Worker Private

Inherits:
Object
  • Object
show all
Includes:
Unparser::Adamantium
Defined in:
lib/mutant/parallel/worker.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Config

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(**attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
# File 'lib/mutant/parallel/worker.rb', line 23

def self.start(**attributes)
  start_config(Config.new(**attributes))
end

Instance Method Details

#callself

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Run worker payload

Returns:

  • (self)


73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/mutant/parallel/worker.rb', line 73

def call
  loop do
    job = next_job or break

    job_start(job)

    result = connection.call(job.payload)

    job_done(job)

    break if add_result(result)
  end

  finalize

  self
end

#indexObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



66
67
68
# File 'lib/mutant/parallel/worker.rb', line 66

def index
  config.index
end

#joinObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



96
97
98
99
# File 'lib/mutant/parallel/worker.rb', line 96

def join
  process.wait(pid)
  self
end

#signalObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



91
92
93
94
# File 'lib/mutant/parallel/worker.rb', line 91

def signal
  process.kill('TERM', pid)
  self
end