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


Python Worker.put_key_in_memory方法代码示例

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


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

示例1: test_no_workers_to_memory

# 需要导入模块: from distributed import Worker [as 别名]
# 或者: from distributed.Worker import put_key_in_memory [as 别名]
def test_no_workers_to_memory(c, s):
    x = delayed(slowinc)(1, delay=0.4)
    y = delayed(slowinc)(x, delay=0.4)
    z = delayed(slowinc)(y, delay=0.4)

    yy, zz = c.persist([y, z])

    while not s.tasks:
        yield gen.sleep(0.01)

    w = Worker(s.ip, s.port, ncores=1)
    w.put_key_in_memory(y.key, 3)

    yield w._start()

    start = time()

    while not s.workers:
        yield gen.sleep(0.01)

    assert s.get_task_status(keys={x.key, y.key, z.key}) == {
        x.key: 'released',
        y.key: 'memory',
        z.key: 'processing',
    }

    yield w._close()
开发者ID:tomMoral,项目名称:distributed,代码行数:29,代码来源:test_scheduler.py

示例2: test_no_worker_to_memory_restrictions

# 需要导入模块: from distributed import Worker [as 别名]
# 或者: from distributed.Worker import put_key_in_memory [as 别名]
def test_no_worker_to_memory_restrictions(c, s, a, b):
    x = delayed(slowinc)(1, delay=0.4)
    y = delayed(slowinc)(x, delay=0.4)
    z = delayed(slowinc)(y, delay=0.4)

    yy, zz = c.persist([y, z], workers={(x, y, z): 'alice'})

    while not s.tasks:
        yield gen.sleep(0.01)

    w = Worker(s.ip, s.port, ncores=1, name='alice')
    w.put_key_in_memory(y.key, 3)

    yield w._start()

    while len(s.workers) < 3:
        yield gen.sleep(0.01)
    yield gen.sleep(0.3)

    assert s.get_task_status(keys={x.key, y.key, z.key}) == {
        x.key: 'released',
        y.key: 'memory',
        z.key: 'processing',
    }

    yield w._close()
开发者ID:tomMoral,项目名称:distributed,代码行数:28,代码来源:test_scheduler.py

示例3: test_worker_arrives_with_processing_data

# 需要导入模块: from distributed import Worker [as 别名]
# 或者: from distributed.Worker import put_key_in_memory [as 别名]
def test_worker_arrives_with_processing_data(c, s, a, b):
    x = delayed(slowinc)(1, delay=0.4)
    y = delayed(slowinc)(x, delay=0.4)
    z = delayed(slowinc)(y, delay=0.4)

    yy, zz = c.persist([y, z])

    while not any(w.processing for w in s.workers.values()):
        yield gen.sleep(0.01)

    w = Worker(s.ip, s.port, ncores=1)
    w.put_key_in_memory(y.key, 3)

    yield w._start()

    start = time()

    while len(s.workers) < 3:
        yield gen.sleep(0.01)

    assert s.get_task_status(keys={x.key, y.key, z.key}) == {
        x.key: 'released',
        y.key: 'memory',
        z.key: 'processing',
    }

    yield w._close()
开发者ID:tomMoral,项目名称:distributed,代码行数:29,代码来源:test_scheduler.py


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