Class: Gorgon::Job
- Inherits:
-
Object
- Object
- Gorgon::Job
- Defined in:
- lib/gorgon/job.rb
Instance Method Summary collapse
- #add_worker ⇒ Object
-
#initialize(listener, job_definition) ⇒ Job
constructor
A new instance of Job.
- #on_worker_complete ⇒ Object
- #setup_child_process ⇒ Object
Constructor Details
#initialize(listener, job_definition) ⇒ Job
Returns a new instance of Job.
3 4 5 6 |
# File 'lib/gorgon/job.rb', line 3 def initialize(listener, job_definition) @workers = [] @definition = job_definition end |
Instance Method Details
#add_worker ⇒ Object
10 11 12 |
# File 'lib/gorgon/job.rb', line 10 def add_worker end |
#on_worker_complete ⇒ Object
14 15 16 17 |
# File 'lib/gorgon/job.rb', line 14 def on_worker_complete @available_worker_slots += 1 on_current_job_complete if current_job_complete? end |
#setup_child_process ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/gorgon/job.rb', line 19 def setup_child_process worker = ChildProcess.build("gorgon", "work", @worker_communication.name, @config_filename) worker_output = Tempfile.new("gorgon-worker") worker.io.stdout = worker_output worker.io.stderr = worker_output worker end |