コード例 #1
0
ファイル: test_executor.py プロジェクト: minrk/distributed
def test_upload_file_exception(s, a, b):
    e = Executor((s.ip, s.port), start=False)
    yield e._start()

    with tmp_text('myfile.py', 'syntax-error!') as fn:
        with pytest.raises(SyntaxError):
            yield e._upload_file(fn)

    yield e._shutdown()
コード例 #2
0
ファイル: test_executor.py プロジェクト: aterrel/distributed
    def f(c, a, b):
        e = Executor((c.ip, c.port), start=False, loop=loop)
        yield e._start()

        with tmp_text('myfile.py', 'syntax-error!') as fn:
            with pytest.raises(SyntaxError):
                yield e._upload_file(fn)

        yield e._shutdown()
コード例 #3
0
def test_upload_file_exception(s, a, b):
    e = Executor((s.ip, s.port), start=False)
    yield e._start()

    with tmp_text('myfile.py', 'syntax-error!') as fn:
        with pytest.raises(SyntaxError):
            yield e._upload_file(fn)

    yield e._shutdown()
コード例 #4
0
def test_upload_file_sync(loop):
    with cluster() as (c, [a, b]):
        with Executor(('127.0.0.1', c['port'])) as e:
            def g():
                import myfile
                return myfile.x

            with tmp_text('myfile.py', 'x = 123') as fn:
                e.upload_file(fn)
                x = e.submit(g)
                assert x.result() == 123
コード例 #5
0
def test_upload_file_sync(loop):
    with cluster() as (s, [a, b]):
        with Executor(('127.0.0.1', s['port'])) as e:
            def g():
                import myfile
                return myfile.x

            with tmp_text('myfile.py', 'x = 123') as fn:
                e.upload_file(fn)
                x = e.submit(g)
                assert x.result() == 123
コード例 #6
0
ファイル: test_executor.py プロジェクト: aterrel/distributed
    def f(c, a, b):
        e = Executor((c.ip, c.port), start=False, loop=loop)
        yield e._start()

        def g():
            import myfile
            return myfile.f()

        with tmp_text('myfile.py', 'def f():\n    return 123') as fn:
            yield e._upload_file(fn)

        sleep(1)  # TODO:  why is this necessary?
        x = e.submit(g, pure=False)
        result = yield x._result()
        assert result == 123

        with tmp_text('myfile.py', 'def f():\n    return 456') as fn:
            yield e._upload_file(fn)

        y = e.submit(g, pure=False)
        result = yield y._result()
        assert result == 456

        yield e._shutdown()
コード例 #7
0
def test_upload_file(s, a, b):
    e = Executor((s.ip, s.port), start=False)
    yield e._start()

    def g():
        import myfile
        return myfile.f()

    with tmp_text('myfile.py', 'def f():\n    return 123') as fn:
        yield e._upload_file(fn)

    sleep(1)  # TODO:  why is this necessary?
    x = e.submit(g, pure=False)
    result = yield x._result()
    assert result == 123

    with tmp_text('myfile.py', 'def f():\n    return 456') as fn:
        yield e._upload_file(fn)

    y = e.submit(g, pure=False)
    result = yield y._result()
    assert result == 456

    yield e._shutdown()
コード例 #8
0
    def f(c, a, b):
        e = Executor((c.ip, c.port), start=False, loop=loop)
        yield e._start()

        def g():
            import myfile
            return myfile.x

        with tmp_text('myfile.py', 'x = 123') as fn:
            yield e._upload_file(fn)

            x = e.submit(g)
            result = yield x._result()
            assert result == 123

        yield e._shutdown()
コード例 #9
0
ファイル: test_executor.py プロジェクト: aterrel/distributed
def test_upload_file_exception_sync(loop):
    with cluster() as (c, [a, b]):
        with Executor(('127.0.0.1', c['port'])) as e:
            with tmp_text('myfile.py', 'syntax-error!') as fn:
                with pytest.raises(SyntaxError):
                    e.upload_file(fn)
コード例 #10
0
def test_upload_file_exception_sync(loop):
    with cluster() as (s, [a, b]):
        with Executor(('127.0.0.1', s['port'])) as e:
            with tmp_text('myfile.py', 'syntax-error!') as fn:
                with pytest.raises(SyntaxError):
                    e.upload_file(fn)