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.



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

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 loop

rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize

Returns:

  • (self)


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/mutant/parallel/worker.rb', line 90

def call
  loop do
    job = next_job or break

    job_start(job)

    connection.send_value(job.payload)

    response = Connection::Reader.read_response(
      deadline:        config.world.deadline(config.timeout),
      io:              config.world.io,
      job:,
      log_reader:,
      marshal:         config.world.marshal,
      response_reader:
    )

    job_done(job)

    break if add_response(response) || response.error
  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.



80
81
82
# File 'lib/mutant/parallel/worker.rb', line 80

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.



124
125
126
127
# File 'lib/mutant/parallel/worker.rb', line 124

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.

rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength



119
120
121
122
# File 'lib/mutant/parallel/worker.rb', line 119

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