def run(self): while True: job = self.tasks_queue.get() #print "worker %i job %i" % ( # self.DEBUG_task_number, job.job_type) #print job.st, job.job_type #print job.instrument_number if job.job_type in state.JOBS_WITH_CONTROLLER: job.controller = self.get_controller( job.inst_type, job.inst_type, job.inst_num, ) if job.job_type == vivi_defines.TASK_TRAINING: job = train.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_ACCURACY: job = accuracy.calculate(job, self.process_step) # elif job.job_type == vivi_defines.TASK_VERIFY: job = verify.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_STABLE: job = stable.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_ATTACK: job = attack.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_DAMPEN: job = dampen.calculate(job, self.process_step) # elif job.job_type == vivi_defines.TASK_LILYPOND: job = lilypond_compile.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_RENDER_AUDIO: job = render_audio.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_MIX_AUDIO: job = mix_audio.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_PLAY_AUDIO: job = play_media.play_audio(job, self.process_step) elif job.job_type == vivi_defines.TASK_HILL_CLIMBING: job = hill_climbing.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_MIX_HILL: job = mix_hill.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_RENDER_VIDEO_PREVIEW: job = render_video.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_RENDER_VIDEO: job = render_video.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_MIX_VIDEO: job = mix_video.calculate(job, self.process_step) elif job.job_type == vivi_defines.TASK_PLAY_VIDEO_PREVIEW: job = play_media.play_video(job, self.process_step) elif job.job_type == vivi_defines.TASK_PLAY_VIDEO: job = play_media.play_video(job, self.process_step) else: raise Exception("Unknown job type") self.process_step.emit() self.tasks_queue.task_done() self.results_queue.put(job) self.done_task.emit()
def calculate(job, process_step): return render_audio.calculate(job, process_step)