Class: Gearman::Worker::Job
- Inherits:
-
Object
- Object
- Gearman::Worker::Job
- Defined in:
- lib/gearman/worker.rb
Overview
Job
Description
Interface to allow a worker to report information to a job server.
Instance Method Summary collapse
-
#initialize(sock, handle) ⇒ Job
constructor
Create a new Job.
-
#report_status(numerator, denominator) ⇒ Object
Report our status to the job server.
-
#report_warning(warning) ⇒ Object
Send a warning explicitly.
-
#send_data(data) ⇒ Object
Send data before job completes.
Constructor Details
#initialize(sock, handle) ⇒ Job
Create a new Job.
70 71 72 73 |
# File 'lib/gearman/worker.rb', line 70 def initialize(sock, handle) @socket = sock @handle = handle end |
Instance Method Details
#report_status(numerator, denominator) ⇒ Object
Report our status to the job server.
77 78 79 80 81 82 |
# File 'lib/gearman/worker.rb', line 77 def report_status(numerator, denominator) req = Util.pack_request( :work_status, "#{@handle}\0#{numerator}\0#{denominator}") Util.send_request(@socket, req) self end |
#report_warning(warning) ⇒ Object
Send a warning explicitly
94 95 96 97 98 |
# File 'lib/gearman/worker.rb', line 94 def report_warning(warning) req = Util.pack_request(:work_warning, "#{@handle}\0#{warning}") Util.send_request(@socket, req) self end |
#send_data(data) ⇒ Object
Send data before job completes
86 87 88 89 90 |
# File 'lib/gearman/worker.rb', line 86 def send_data(data) req = Util.pack_request(:work_data, "#{@handle}\0#{data}") Util.send_request(@socket, req) self end |