Exemplo n.º 1
0
 async def setup(self) -> None:
     cb_endpoint = ipc.ServerEndpoint(self.__cb_endpoint_name)
     cb_endpoint.add_handler('NODEDB_MUTATION', self.__handle_mutation,
                             node_db_pb2.Mutation,
                             empty_message_pb2.EmptyMessage)
     self.__cb_endpoint_address = await self.server.add_endpoint(cb_endpoint
                                                                 )
Exemplo n.º 2
0
    async def setup(self) -> None:
        await super().setup()

        endpoint = ipc.ServerEndpoint('main')
        endpoint.add_handler('CREATE', self.__handle_create,
                             writer_process_pb2.CreateRequest,
                             writer_process_pb2.CreateResponse)
        endpoint.add_handler('OPEN', self.__handle_open,
                             writer_process_pb2.OpenRequest,
                             writer_process_pb2.OpenResponse)
        endpoint.add_handler('CLOSE', self.__handle_close,
                             empty_message_pb2.EmptyMessage,
                             empty_message_pb2.EmptyMessage)
        endpoint.add_handler('WRITE_LOG', self.__handle_write_log,
                             writer_process_pb2.WriteLogRequest,
                             writer_process_pb2.WriteResponse)
        endpoint.add_handler('WRITE_CHECKPOINT',
                             self.__handle_write_checkpoint,
                             writer_process_pb2.WriteCheckpointRequest,
                             writer_process_pb2.WriteResponse)
        endpoint.add_handler('UNDO', self.__handle_undo,
                             empty_message_pb2.EmptyMessage,
                             writer_process_pb2.UndoResponse)
        endpoint.add_handler('REDO', self.__handle_redo,
                             empty_message_pb2.EmptyMessage,
                             writer_process_pb2.RedoResponse)
        await self.server.add_endpoint(endpoint)
Exemplo n.º 3
0
 async def setup(self) -> None:
     cb_endpoint = ipc.ServerEndpoint(self.__cb_endpoint_name)
     cb_endpoint.add_handler('INSTRUMENTDB_MUTATIONS',
                             self.__handle_mutation,
                             instrument_db_pb2.Mutations,
                             empty_message_pb2.EmptyMessage)
     self.__cb_endpoint_address = await self.server.add_endpoint(cb_endpoint
                                                                 )
Exemplo n.º 4
0
 async def setup(self) -> None:
     cb_endpoint = ipc.ServerEndpoint(self.__cb_endpoint_name)
     cb_endpoint.add_handler(
         'CONTROL_VALUE_CHANGE', self.__handle_control_value_change,
         audioproc.ControlValueChange, empty_message_pb2.EmptyMessage)
     cb_endpoint.add_handler(
         'PLUGIN_STATE_CHANGE', self.__handle_plugin_state_change,
         audioproc.PluginStateChange, empty_message_pb2.EmptyMessage)
     self.__cb_endpoint_address = await self.__server.add_endpoint(cb_endpoint)
    async def setup_testcase(self):
        self.mgr = core.ProcessManager(event_loop=self.loop)
        await self.mgr.setup()

        cb_endpoint = ipc.ServerEndpoint('urid_cb')
        cb_endpoint.add_handler('NEW_URIS', self.handle_new_uris,
                                urid_mapper_pb2.NewURIsRequest,
                                empty_message_pb2.EmptyMessage)
        self.cb_endpoint_address = await self.server.add_endpoint(cb_endpoint)
Exemplo n.º 6
0
    async def setup_testcase(self):
        self.pool = project.Pool()
        self.project = self.pool.create(project.BaseProject)

        cb_endpoint = ipc.ServerEndpoint('player_cb')
        self.cb_endpoint_address = await self.server.add_endpoint(cb_endpoint)

        self.session_values = session_value_store.SessionValueStore(self.loop, 'test')
        await self.session_values.init(TEST_OPTS.TMP_DIR)
Exemplo n.º 7
0
    async def setup(self) -> None:
        await super().setup()

        cb_endpoint = ipc.ServerEndpoint(self.__cb_endpoint_name)
        cb_endpoint.add_handler('ENGINE_NOTIFICATION',
                                self.__handle_engine_notification,
                                engine_notification_pb2.EngineNotification,
                                empty_message_pb2.EmptyMessage)

        self.__cb_endpoint_address = await self.server.add_endpoint(cb_endpoint
                                                                    )
    async def setup_testcase(self):
        self.done = asyncio.Event(loop=self.loop)

        self.shm = posix_ipc.SharedMemory(
            name='/test-shm-%s' % uuid.uuid4().hex,
            flags=os.O_CREAT | os.O_EXCL,
            size=2**20)

        self.shm_data = mmap.mmap(self.shm.fd, self.shm.size)

        self.cb_endpoint = ipc.ServerEndpoint('project_cb')
        self.cb_endpoint_address = await self.server.add_endpoint(self.cb_endpoint)

        self.setup_urid_mapper_process(inline=False)
Exemplo n.º 9
0
    async def __runRenderer(self, path: str) -> None:
        tmp_path = path + '.partial'
        cb_endpoint_address = None

        try:
            self.__out_fp = open(tmp_path, 'wb')

            cb_endpoint = ipc.ServerEndpoint('render_cb')
            cb_endpoint.add_handler('STATE', self.__onRendererState,
                                    music.RenderStateRequest,
                                    empty_message_pb2.EmptyMessage)
            cb_endpoint.add_handler('PROGRESS', self.__onRendererProgress,
                                    music.RenderProgressRequest,
                                    music.RenderProgressResponse)
            cb_endpoint.add_handler('DATA', self.__onRendererData,
                                    music.RenderDataRequest,
                                    music.RenderDataResponse)
            cb_endpoint_address = await self.app.process.server.add_endpoint(
                cb_endpoint)

            await self.project_client.render(cb_endpoint_address,
                                             self.__settings)

            assert self.__renderer_state is not None

            self.__out_fp.close()
            self.__out_fp = None

            if os.path.exists(path):
                os.unlink(path)
            os.rename(tmp_path, path)

        except Exception as exc:  # pylint: disable=broad-except
            logger.exception("Project renderer failed with an exception:")
            self.__renderer_state = 'failed'
            self.__failure_reason = str(exc)

        finally:
            if cb_endpoint_address is not None:
                await self.app.process.server.remove_endpoint('render_cb')

            if self.__out_fp is not None:
                self.__out_fp.close()
                self.__out_fp = None

            if os.path.exists(tmp_path):
                os.unlink(tmp_path)