【问题标题】:How to assign tasks to specific worker within Dask.Distributed如何将任务分配给 Dask.Distributed 中的特定工作人员
【发布时间】:2018-07-23 22:38:18
【问题描述】:

我对使用 Dask Distributed 作为任务执行器很感兴趣。 在 Celery 中,可以将任务分配给特定的工人。如何使用 Dask Distributed?

【问题讨论】:

    标签: dask-distributed


    【解决方案1】:

    有两种选择:

    1. Specify workers by name 或主机或 IP(但只有正面声明):

      dask-worker scheduler_address:8786 --name worker_1
      

      然后是选项之一:

      client.map(func, sequence, workers='worker_1')
      client.map(func, sequence, workers=['192.168.1.100', '192.168.1.100:8989', 'alice', 'alice:8989'])
      client.submit(f, x, workers='127.0.0.1')
      client.submit(f, x, workers='127.0.0.1:55852')
      client.submit(f, x, workers=['192.168.1.101', '192.168.1.100'])
      future = client.compute(z, workers={z: '127.0.0.1',
                                      x: '192.168.0.1:9999'})
      future = client.compute(z, workers={(x, y): ['192.168.1.100', '192.168.1.101:9999']})
      
    2. 使用Resources 概念。您可以为工作人员指定可用资源,例如:

      dask-worker scheduler:8786 --resources "CAN_PROCESS_QUEUE_ALICE=2"
      

      并指定所需的资源,例如

      client.submit(aggregate, processed, resources={'CAN_PROCESS_QUEUE_ALICE': 1})
      

      z = some_dask_object.map_parititons(func)
      z.compute(resources={tuple(y.__dask_keys__()): {'CAN_PROCESS_QUEUE_ALICE': 1})
      

    【讨论】:

      猜你喜欢
      • 2022-08-22
      • 1970-01-01
      • 2020-09-12
      • 2019-12-25
      • 1970-01-01
      • 2014-06-28
      • 1970-01-01
      • 2018-06-04
      • 1970-01-01
      相关资源
      最近更新 更多