Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dask support #278

@aplavin

Description

@aplavin

Dask itself has a basic progressbar, but tqdm is certainly better - so I made a basic wrapper:

from dask.callbacks import Callback

class ProgressBar(Callback):
    def _start_state(self, dsk, state):
        self._tqdm = tqdm_notebook(total=sum(len(state[k]) for k in ['ready', 'waiting', 'running', 'finished']))

    def _posttask(self, key, result, dsk, state, worker_id):
        self._tqdm.update(1)

    def _finish(self, dsk, state, errored):
        pass

Usage (the same as dask progressbar):

with ProgressBar():
    ... .compute()

Does it belong to tqdm, what to you think? Also, any further suggestions/improvements?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions