dask:如何避免任务超时?

时间:2018-12-19 06:00:45

标签: python distributed dask

在基于dask的应用程序中(使用distributed调度程序),我看到了以以下错误文本开头的失败:

tornado.application - ERROR - Exception in Future <Future cancelled> after timeout
Traceback (most recent call last):
  File "/miniconda/envs/flyem/lib/python3.6/site-packages/tornado/gen.py", line 970, in error_callback
    future.result()
concurrent.futures._base.CancelledError

在它们之后进行第二次回溯(我认为),该回溯表明发生超时时我的任务正在运行的行。 (确切地说,distributed如何做到这一点-可能是通过信号?)

这是第二次回溯的较快部分:

  ... my code...

  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/dask/base.py", line 156, in compute
    (result,) = compute(self, traverse=False, **kwargs)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/dask/base.py", line 397, in compute
    results = schedule(dsk, keys, **kwargs)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/distributed/client.py", line 2308, in get
    direct=direct)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/distributed/client.py", line 1647, in gather
    asynchronous=asynchronous)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/distributed/client.py", line 665, in sync
    return sync(self.loop, func, *args, **kwargs)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/distributed/utils.py", line 277, in sync
    six.reraise(*error[0])
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/distributed/utils.py", line 262, in f
    result[0] = yield future
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/tornado/gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/distributed/client.py", line 1492, in _gather
    traceback)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/dask/bag/core.py", line 1562, in reify
    seq = list(seq)
  File "/groups/flyem/proj/cluster/miniforge/envs/flyem/lib/python3.6/site-packages/dask/bag/core.py", line 1722, in map_chunk
    yield f(*a)

  ... my code ....
  1. after timeout是否指示任务花费了太长时间,或者是否有其他超时触发取消,例如保姆或心跳超时? (据我所知,任务的长度并没有明确的超时,但是也许我很困惑。)

  2. 我看到任务已取消。但是我想知道为什么。是否有任何简便的方法来找出(daskdistributed中的哪一行代码正在取消我的任务,为什么?

  3. 期望需要很长时间-他们正在将大型缓冲区上传到云存储。我如何才能增加特定任务的超时时间?

1 个答案:

答案 0 :(得分:1)

默认情况下,Dask不会对任务强加超时。

您看到的取消的未来不是Dask的未来,而是龙卷风的未来(Tornado是Dask用于网络通信的库)。因此,不幸的是,这一切都是失败的。

随后的回溯有望包含有关失败代码的确切信息。理想情况下,它指向函数中发生故障的一行。也许有帮助吗?

通常,在调试通过Dask运行的代码时,我们建议执行以下步骤:http://docs.dask.org/en/latest/debugging.html