用法:
dask.annotate(**annotations)
用於設置 HighLevelGraph 層注釋的上下文管理器。
注釋是與 dask 調度程序可能選擇尊重的任務相關的元數據或軟約束:它們在不強製執行硬約束的情況下發出意圖。因此,它們主要設計用於分布式調度程序。
幾乎任何對象都可以用作注解,但首選 Python 小對象,不鼓勵使用大型對象(如 NumPy 數組)。
作為注釋提供的可調用對象應采用單個鍵參數並生成適當的注釋。注釋集合中的各個任務鍵被提供給可調用對象。
- **annotations:鍵值對
參數:
例子:
陣列 A 中的所有任務的優先級應為 100,並在失敗時重試 3 次。
>>> import dask >>> import dask.array as da >>> with dask.annotate(priority=100, retries=3): ... A = da.ones((10000, 10000))
將陣列 A 中的任務按扁平塊 ID 劃分優先級。
>>> nblocks = (10, 10) >>> with dask.annotate(priority=lambda k: k[1]*nblocks[1] + k[2]): ... A = da.ones((1000, 1000), chunks=(100, 100))
注釋可以嵌套。
>>> with dask.annotate(priority=1): ... with dask.annotate(retries=3): ... A = da.ones((1000, 1000)) ... B = A + 1
相關用法
- Python dask.array.stats.ttest_ind用法及代碼示例
- Python dask.array.ma.masked_values用法及代碼示例
- Python dask.array.divmod用法及代碼示例
- Python dask.array.negative用法及代碼示例
- Python dask.array.overlap.map_overlap用法及代碼示例
- Python dask.array.stats.ttest_rel用法及代碼示例
- Python dask.array.ma.average用法及代碼示例
- Python dask.array.vstack用法及代碼示例
- Python dask.array.isneginf用法及代碼示例
- Python dask.array.ma.masked_array用法及代碼示例
- Python dask.array.matmul用法及代碼示例
- Python dask.array.random.weibull用法及代碼示例
- Python dask.array.Array.compute_chunk_sizes用法及代碼示例
- Python dask.array.random.geometric用法及代碼示例
- Python dask.array.around用法及代碼示例
- Python dask.array.gradient用法及代碼示例
- Python dask.array.coarsen用法及代碼示例
- Python dask.array.fft.ifftshift用法及代碼示例
- Python dask.array.Array.visualize用法及代碼示例
- Python dask.array.square用法及代碼示例
注:本文由純淨天空篩選整理自dask.org大神的英文原創作品 dask.annotate。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。