class RenderWorker(object): def __init__(self, comm_host, blender_exec, blender_config, save_loc, manager_url, scene_path, **kwargs): self._comm_host = comm_host self._murl = manager_url # These are the communication members self._connection = None self.channel = None # Replace these later bn = BlenderNode( blender_exec, blender_config, scene_path, kwargs["timeout"], kwargs["attempts"] ) self._renderManager = RenderNode(); self._renderManager.register_renderer("BLENDER", bn ); self._renderManager.set_active_engine( "BLENDER" ) # periodic checks self.last_render_check = datetime.datetime.now() self.render_started = False self._save_location = save_loc def initiate_broker_communications(self, ): self._connection = None while self._connection == None: try: LOGGER.info( "Connecting to Broker..." ) parameters = pika.URLParameters(self._comm_host) self._connection = pika.BlockingConnection(parameters) except Exception, e: LOGGER.info(str(e)) LOGGER.info(traceback.format_exc()) time.sleep(5) self.channel = self._connection.channel() self.channel.queue_declare(queue='render_queue', durable=True, exclusive=False, auto_delete=False) self.channel.queue_declare(queue='log_queue', durable=True, exclusive=False, auto_delete=False) LOGGER.info(' [*] Waiting for messages. To exit press CTRL+C') self.channel.basic_qos(prefetch_count=1) self.channel.basic_consume(self.callback, queue='render_queue')
def __init__(self, comm_host, blender_exec, blender_config, save_loc, manager_url, scene_path, **kwargs): self._comm_host = comm_host self._murl = manager_url # These are the communication members self._connection = None self.channel = None # Replace these later bn = BlenderNode( blender_exec, blender_config, scene_path, kwargs["timeout"], kwargs["attempts"] ) self._renderManager = RenderNode(); self._renderManager.register_renderer("BLENDER", bn ); self._renderManager.set_active_engine( "BLENDER" ) # periodic checks self.last_render_check = datetime.datetime.now() self.render_started = False self._save_location = save_loc