knime-geospatial-extension icon indicating copy to clipboard operation
knime-geospatial-extension copied to clipboard

Report progress where ever possible especially during potentially long running processes e.g. reading files

Open koettert opened this issue 2 years ago • 0 comments

KNIME provides a method provide progress information through the UI and we should make use of it as much as possible, Unfortunately Geopandas does not provide a build in mechanism for this. A potential way could be to use tqdm.

This is example code that converts tqdm to the KNIME progress methods:

@contextlib.contextmanager def tqdm_to_knime(exec_context: knext.ExecutionContext): from tqdm import tqdm

def mock_display(self, msg=None, pos=None):
    # TODO set the message
    exec_context.set_progress(self.n / self.total)
    return True

real_display = tqdm.display

try:
    tqdm.display = mock_display
    yield
finally:
    tqdm.display = real_display

koettert avatar Dec 15 '22 11:12 koettert