Class: Gearman::Job
- Inherits:
-
Object
- Object
- Gearman::Job
- Defined in:
- lib/gearman/job.rb
Overview
Job
Description
Interface to allow a worker to report information to a job server.
Instance Method Summary collapse
-
#initialize(client, 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_partial(data) ⇒ Object
(also: #send_data)
Send data before job completes.
Constructor Details
#initialize(client, handle) ⇒ Job
Create a new Job.
12 13 14 15 |
# File 'lib/gearman/job.rb', line 12 def initialize(client, handle) @client = client @handle = handle end |
Instance Method Details
#report_status(numerator, denominator) ⇒ Object
Report our status to the job server.
18 19 20 21 |
# File 'lib/gearman/job.rb', line 18 def report_status(numerator, denominator) @client.send :work_status, "#{@handle}\0#{numerator}\0#{denominator}" self end |
#report_warning(warning) ⇒ Object
Send a warning explicitly
33 34 35 36 |
# File 'lib/gearman/job.rb', line 33 def report_warning(warning) @client.send :work_warning, "#{@handle}\0#{warning}" self end |
#send_partial(data) ⇒ Object Also known as: send_data
Send data before job completes
25 26 27 28 |
# File 'lib/gearman/job.rb', line 25 def send_partial(data) @client.send :work_data, "#{@handle}\0#{data}" self end |