How to use the imjoy.workers.python3_client.JOB_HANDLERS_PY3.get 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
job = await async_q.get()
                async_q.task_done()
                if job is None:
                    continue

                if "setInterface" == job["type"]:
                    api = self.conn.set_remote(job["api"])
                    self.conn.local["np"] = np
                    self.conn.emit({"type": "interfaceSetAsRemote"})
                    if not self.conn.init:
                        self.conn.set_interface(self.imjoy_api)
                        self.conn.init = True
                    async_q.task_done()
                else:
                    handler = JOB_HANDLERS_PY3.get(job["type"])
                    if handler is None:
                        continue
                    try:
                        await handler(self.conn, job, logger)
                    except Exception:  # pylint: disable=broad-except
                        logger.error(
                            "Error occured in the loop %s", traceback.format_exc()
                        )
                    finally:
                        sys.stdout.flush()
            except Exception as e:
                print(e)
github oeway / ImJoy-Engine / tests / mock_plugin.py View on Github external
job = await async_q.get()
                async_q.task_done()
                if job is None:
                    continue

                if "setInterface" == job["type"]:
                    api = self.conn.set_remote(job["api"])
                    self.conn.local["np"] = np
                    self.conn.emit({"type": "interfaceSetAsRemote"})
                    if not self.conn.init:
                        self.conn.set_interface(self.imjoy_api)
                        self.conn.init = True
                    async_q.task_done()
                else:
                    handler = JOB_HANDLERS_PY3.get(job["type"])
                    if handler is None:
                        continue
                    try:
                        await handler(self.conn, job, logger)
                    except Exception:  # pylint: disable=broad-except
                        logger.error(
                            "Error occured in the loop %s", traceback.format_exc()
                        )
                    finally:
                        sys.stdout.flush()
            except Exception as e:
                print(e)