How to use the imjoy.workers.python_worker.PluginConnection function in imjoy

To help you get started, we’ve selected a few imjoy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oeway / ImJoy-Engine / tests / mock_plugin.py View on Github external
async def init(self):
        """initialize the plugin."""
        opt = dotdict(id=self.pid, secret=self.secret)
        self.conn = PluginConnection(self, opt)
        self.conn.setup()
        self.terminated = False
        initialized = self.loop.create_future()
        self.on_plugin_message("initialized", initialized)
        self.on_plugin_message("disconnected", self.terminate)
        await initialized

        workers = [
            self.message_worker(self.janus_queue.async_q, self.conn.abort)
            for i in range(2)
        ]
        asyncio.ensure_future(asyncio.gather(*workers))
github oeway / ImJoy-Engine / tests / mock_plugin.py View on Github external
async def init(self):
        """initialize the plugin."""
        opt = dotdict(id=self.pid, secret=self.secret)
        self.conn = PluginConnection(opt, client=self)
        self.terminated = False
        initialized = self.loop.create_future()
        self.on_plugin_message("initialized", initialized)
        self.on_plugin_message("disconnected", self.terminate)
        await initialized

        workers = [
            self.message_worker(self.janus_queue.async_q, self.conn.abort)
            for i in range(2)
        ]
        asyncio.ensure_future(asyncio.gather(*workers))
github oeway / ImJoy-Engine / imjoy / workers / python_worker.py View on Github external
)
    parser.add_argument("--daemon", action="store_true", help="daemon mode")
    parser.add_argument("--debug", action="store_true", help="debug mode")

    opt = parser.parse_args()

    logging.basicConfig(stream=sys.stdout)
    logger.setLevel(logging.INFO)
    if opt.debug:
        logger.setLevel(logging.DEBUG)

    if PYTHON34:
        client = AsyncClient()
    else:
        client = Client()
    plugin_conn = PluginConnection(client, opt)
    plugin_conn.start()
github oeway / ImJoy-Engine / imjoy / workers / python_worker.py View on Github external
def add_plugin(plugin_id, client_id):
        opt = dotdict(id=plugin_id, secret="", work_dir="")
        client = BaseClient.get_client(client_id)
        p = PluginConnection(client, opt)
        return p
github oeway / ImJoy-Engine / imjoy / workers / python_worker.py View on Github external
def get_plugin(plugin_id):
        return PluginConnection._registered_plugins.get(plugin_id)