How to use the execnet.gateway_base.get_execmodel function in execnet

To help you get started, we’ve selected a few execnet 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 pytest-dev / execnet / execnet / script / socketserver.py View on Github external
break
    finally:
        print_("leaving socketserver execloop")
        serversock.shutdown(2)


if __name__ == "__main__":
    import sys

    if len(sys.argv) > 1:
        hostport = sys.argv[1]
    else:
        hostport = ":8888"
    from execnet.gateway_base import get_execmodel

    execmodel = get_execmodel("thread")
    serversock = bind_and_listen(hostport, execmodel)
    startserver(serversock, loop=False)
elif __name__ == "__channelexec__":
    chan = globals()["channel"]
    execmodel = chan.gateway.execmodel
    bindname = chan.receive()
    sock = bind_and_listen(bindname, execmodel)
    port = sock.getsockname()
    chan.send(port)
    startserver(sock)
github pytest-dev / execnet / execnet / multi.py View on Github external
execmodel can be one of "thread" or "eventlet" (XXX gevent).
        It determines the execution model for any newly created gateway.
        If remote_execmodel is not specified it takes on the value
        of execmodel.

        NOTE: Execution models can only be set before any gateway is created.

        """
        if self._gateways:
            raise ValueError(
                "can not set execution models if " "gateways have been created already"
            )
        if remote_execmodel is None:
            remote_execmodel = execmodel
        self._execmodel = get_execmodel(execmodel)
        self._remote_execmodel = get_execmodel(remote_execmodel)
github pytest-dev / execnet / execnet / multi.py View on Github external
execmodel can be one of "thread" or "eventlet" (XXX gevent).
        It determines the execution model for any newly created gateway.
        If remote_execmodel is not specified it takes on the value
        of execmodel.

        NOTE: Execution models can only be set before any gateway is created.

        """
        if self._gateways:
            raise ValueError(
                "can not set execution models if " "gateways have been created already"
            )
        if remote_execmodel is None:
            remote_execmodel = execmodel
        self._execmodel = get_execmodel(execmodel)
        self._remote_execmodel = get_execmodel(remote_execmodel)
github pytest-dev / execnet / execnet / threadpool.py View on Github external
"""
dispatching execution to threads or greenlets

(c) 2013, holger krekel
"""

try:
    from execnet.gateway_base import get_execmodel, WorkerPool
except ImportError:
    from __main__ import get_execmodel, WorkerPool

if __name__ == '__channelexec__':
    size = channel.receive()  # noqa
    execpool = WorkerPool(get_execmodel("thread"), size)
    gw = channel.gateway # noqa
    channel.send("ok") # noqa
    gw._trace("instantiated thread work pool size=%s" %(size,))
    while 1:
        gw._trace("waiting for new exec task")
        task = gw._execqueue.get()
        if task is None:
            gw._trace("thread-dispatcher got None, exiting")
            execpool.waitall()
            raise gw._StopExecLoop
        gw._trace("dispatching exec task to thread pool")
        execpool.spawn(gw.executetask, task)
github alfredodeza / remoto / remoto / lib / execnet / multi.py View on Github external
execmodel can be one of "thread" or "eventlet" (XXX gevent).
        It determines the execution model for any newly created gateway.
        If remote_execmodel is not specified it takes on the value
        of execmodel.

        NOTE: Execution models can only be set before any gateway is created.

        """
        if self._gateways:
            raise ValueError("can not set execution models if "
                             "gateways have been created already")
        if remote_execmodel is None:
            remote_execmodel = execmodel
        self._execmodel = get_execmodel(execmodel)
        self._remote_execmodel = get_execmodel(remote_execmodel)
github alfredodeza / remoto / remoto / lib / execnet / multi.py View on Github external
""" Set the execution model for local and remote site.

        execmodel can be one of "thread" or "eventlet" (XXX gevent).
        It determines the execution model for any newly created gateway.
        If remote_execmodel is not specified it takes on the value
        of execmodel.

        NOTE: Execution models can only be set before any gateway is created.

        """
        if self._gateways:
            raise ValueError("can not set execution models if "
                             "gateways have been created already")
        if remote_execmodel is None:
            remote_execmodel = execmodel
        self._execmodel = get_execmodel(execmodel)
        self._remote_execmodel = get_execmodel(remote_execmodel)