Example #1
0
    def set_execmodel(self, execmodel, remote_execmodel=None):
        """ 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)
Example #2
0
    def set_execmodel(self, execmodel, remote_execmodel=None):
        """ 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)
Example #3
0
def execmodel(request):
    if request.param != "thread":
        pytest.importorskip(request.param)
    if sys.platform == "win32":
             pytest.xfail("eventlet/gevent do not work onwin32")
    return get_execmodel(request.param)
Example #4
0
def execmodel(request):
    if request.param != "thread":
        pytest.importorskip(request.param)
    if sys.platform == "win32":
        pytest.xfail("eventlet/gevent do not work onwin32")
    return get_execmodel(request.param)
Example #5
0
                if debug:
                    import traceback
                    traceback.print_exc()
                else:
                    excinfo = sys.exc_info()
                    print_("got exception", excinfo[1])
            if not loop:
                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__':
    execmodel = channel.gateway.execmodel # noqa
    bindname = channel.receive() # noqa
    sock = bind_and_listen(bindname, execmodel)
    port = sock.getsockname()
    channel.send(port) # noqa
    startserver(sock)
                    print_("got exception", excinfo[1])
            os.chdir(execute_path)
            if not loop:
                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=True)

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)
Example #7
0
def execmodel(request):
    if request.param != "thread":
        pytest.importorskip(request.param)
    if request.param in ("eventlet", "gevent") and sys.platform == "win32":
        pytest.xfail(request.param + " does not work on win32")
    return get_execmodel(request.param)