当前位置: 首页>>代码示例>>Python>>正文


Python dask.get方法代码示例

本文整理汇总了Python中dask.get方法的典型用法代码示例。如果您正苦于以下问题:Python dask.get方法的具体用法?Python dask.get怎么用?Python dask.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dask的用法示例。


在下文中一共展示了dask.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_ephemeral_persisting

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def test_ephemeral_persisting(zk, dsk2):
    with Persist(zk, name="dsk2", ns="/test/dags", ephemeral=True):
        with Ran() as r:
            assert get(dsk2, 'e') == 10
            assert r.steps == ['e']
        with Ran() as r:
            assert get(dsk2, 's') == 0.4
            assert r.steps == ['f', 's']
        with Ran() as r:
            assert get(dsk2, 's') == 0.4
            assert r.steps == []

        assert loads(zk.get("/test/dags/dsk2/e")[0]) == 10

    with pytest.raises(NoNodeError):
        zk.get("/test/dags/dsk2/e") 
开发者ID:daskos,项目名称:daskos,代码行数:18,代码来源:test_context.py

示例2: enable

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def enable(func):
        """
        Decorator to attach the current MPI communicator to the input
        keyword arguments of ``func``, via the ``comm`` keyword.
        """
        import functools
        @functools.wraps(func)
        def wrapped(*args, **kwargs):
            kwargs.setdefault('comm', None)
            if kwargs['comm'] is None:
                kwargs['comm'] = CurrentMPIComm.get()
            return func(*args, **kwargs)
        return wrapped 
开发者ID:bccp,项目名称:nbodykit,代码行数:15,代码来源:__init__.py

示例3: get

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def get(cls):
        """
        Get the default current MPI communicator. The initial value is ``MPI.COMM_WORLD``.
        """
        return cls._stack[-1] 
开发者ID:bccp,项目名称:nbodykit,代码行数:7,代码来源:__init__.py

示例4: __init__

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def __init__(self, **kwargs):
        self.old = _global_options.copy()
        for key in sorted(kwargs):
            if key not in _global_options:
                raise KeyError("Option `%s` is not supported" % key)

        _global_options.update(kwargs)

        # resize the global Cache!
        # FIXME: after https://github.com/dask/cachey/pull/12
        if 'global_cache_size' in kwargs:
            cache = GlobalCache.get().cache
            cache.available_bytes = _global_options['global_cache_size']
            cache.shrink() 
开发者ID:bccp,项目名称:nbodykit,代码行数:16,代码来源:__init__.py

示例5: __exit__

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def __exit__(self, type, value, traceback):
        _global_options.clear()
        _global_options.update(self.old)

        # resize Cache to original size
        # FIXME: after https://github.com/dask/cachey/pull/12
        cache = GlobalCache.get().cache
        cache.available_bytes = _global_options['global_cache_size']
        cache.shrink() 
开发者ID:bccp,项目名称:nbodykit,代码行数:11,代码来源:__init__.py

示例6: test_persisting

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def test_persisting(zk, dsk1):
    with Persist(zk, name="dsk1"):
        with Ran() as r:
            assert get(dsk1, 'w') == 6
            assert r.steps == ['z', 'w']
        with Ran() as r:
            assert get(dsk1, 'w') == 6
            assert r.steps == []

        assert loads(zk.get("/epos/dsk1/z")[0]) == 3
        assert loads(zk.get("/epos/dsk1/w")[0]) == 6

    # tests ephemeral=False, znode still exists after context handler
    assert loads(zk.get("/epos/dsk1/w")[0]) == 6 
开发者ID:daskos,项目名称:daskos,代码行数:16,代码来源:test_context.py

示例7: test_locking

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def test_locking(zk, dsk1):
    with pytest.raises(LockTimeout):
        # two identical locks; the second cannot acquire
        with Lock(zk, name="dsk1", timeout=1), \
                Lock(zk, name="dsk1", timeout=1):
            get(dsk1, 'w')

    # test lock release
    with Lock(zk, name="dsk1"):
        get(dsk1, 'w')
        get(dsk1, 'w') 
开发者ID:daskos,项目名称:daskos,代码行数:13,代码来源:test_context.py

示例8: test_ephemeral_locking

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def test_ephemeral_locking(zk, dsk2):
    with pytest.raises(LockTimeout):
        with Lock(zk, name="dsk2", timeout=1, ephemeral=True), \
                Lock(zk, name="dsk2", timeout=1, ephemeral=True):
            get(dsk2, 'f')

    with pytest.raises(NoNodeError):
        zk.get("/epos/dsk2") 
开发者ID:daskos,项目名称:daskos,代码行数:10,代码来源:test_context.py

示例9: __call__

# 需要导入模块: import dask [as 别名]
# 或者: from dask import get [as 别名]
def __call__(self, dsk, keys, **kwargs):
        """Compute dask task and keep track of number of times we do so."""
        import dask
        self.total_computes += 1
        if self.total_computes > self.max_computes:
            raise RuntimeError("Too many dask computations were scheduled: "
                               "{}".format(self.total_computes))
        return dask.get(dsk, keys, **kwargs) 
开发者ID:pytroll,项目名称:pyresample,代码行数:10,代码来源:utils.py


注:本文中的dask.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。