Class: Gorgon::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/gorgon/job.rb

Instance Method Summary collapse

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_workerObject



10
11
12
# File 'lib/gorgon/job.rb', line 10

def add_worker

end

#on_worker_completeObject



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_processObject



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