def run(self):
     while not self.kill_received:
          # get a task
         try:
             job = self.work_queue.get_nowait()
         except Queue.Empty:
             break
             
         start_time = time.time();    
         
         model_dir=job.model_dir;
         model_name =job.model_name;
         grey_offset = job.grey_offset;
         
         print("Model dir:")
         print model_dir
         print("Model Name:")
         print model_name
         
         
         print("Creating a Scene");
         boxm_batch.init_process("boxmCreateSceneProcess");
         boxm_batch.set_input_string(0,  model_dir + "/" + model_name + ".xml");
         boxm_batch.run_process();
         (scene_id, scene_type) = boxm_batch.commit_output(0);
         scene= dbvalue(scene_id, scene_type);
         
        
         print("Splitting the scene");
         boxm_batch.init_process("boxmSplitSceneProcess");
         boxm_batch.set_input_from_db(0, scene);
         boxm_batch.run_process();
         (scene_id, scene_type) = boxm_batch.commit_output(0);
         apm_scene = dbvalue(scene_id, scene_type);
         (scene_id, scene_type) = boxm_batch.commit_output(1);
         alpha_scene = dbvalue(scene_id, scene_type);
         
         print("Save Scene");
         boxm_batch.init_process("boxmSaveScene    RawProcess");
         boxm_batch.set_input_from_db(0,alpha_scene);
         boxm_batch.set_input_string(1,model_dir + "/drishti/alpha_scene");
         boxm_batch.set_input_unsigned(2,0);
         boxm_batch.set_input_unsigned(3,1);
         boxm_batch.run_process();
         
         #free memory
         boxm_batch.clear();
      
         print ("Runing time for worker:", self.name)
         print(time.time() - start_time);
         
         #output exit code in this case
         #important: having a result queue makes the execute_jobs wait for all jobs in the queue before exiting
         self.result_queue.put(0);
   def run(self):
       while not self.kill_received:
            # get a task
           try:
               job = self.work_queue.get_nowait()
           except Queue.Empty:
               break
               
           start_time = time.time();    
           
           model_dir=job.model_dir;
           ply_file =job.ply_file;
           grey_offset = job.grey_offset;
           
           boxm_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt");
 
             
           boxm_batch.init_process("boxmCreateSceneProcess");
           boxm_batch.set_input_string(0, model_dir +"/pmvs_scene.xml");
           boxm_batch.run_process();
           (scene_id, scene_type) = boxm_batch.commit_output(0);
           scene= dbvalue(scene_id, scene_type);
           
           boxm_batch.init_process("boxm_create_scene_from_ply_process");
           boxm_batch.set_input_string(0,ply_file);
           boxm_batch.set_input_from_db(1,scene);
           boxm_batch.set_input_float(2,grey_offset);
           boxm_batch.run_process();
           (scene_id, scene_type) = boxm_batch.commit_output(0);
           scene = dbvalue(scene_id, scene_type);
           
           
           print("Save Scene");
           boxm_batch.init_process("boxmSaveSceneRawProcess");
           boxm_batch.set_input_from_db(0,scene);
           boxm_batch.set_input_string(1,model_dir + "/drishti/ply_scene");
           boxm_batch.set_input_unsigned(2,0);
           boxm_batch.set_input_unsigned(3,1);
           boxm_batch.run_process();
           
           #free memory
           boxm_batch.reset_stdout();
           boxm_batch.clear();
        
           print ("Runing time for worker:", self.name)
           print(time.time() - start_time);
           
           #output exit code in this case
           #important: having a result queue makes the execute_jobs wait for all jobs in the queue before exiting
           self.result_queue.put(0);