Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Use units in tqdm #29

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Features
- Added default run name handling ([#18](https://github.com/neptune-ai/neptune-client-experimental/pull/18))

### Changes
- Add custom units and descriptions to tqdm progress bars ([#29](https://github.com/neptune-ai/neptune-client-experimental/pull/29))


## neptune-experimental 0.2.1

Expand Down
2 changes: 1 addition & 1 deletion src/neptune_fetcher/custom_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@ def _get_all_items(self, get_portion, step):
previous_items = get_portion(limit=step, offset=len(items))
items += previous_items
# We don't know the size apriori
self.progress_update_handler.on_runs_table_fetch(step)
self.progress_update_handler.on_runs_table_fetch(len(previous_items))
self.progress_update_handler.post_runs_table_fetch()
return items
9 changes: 3 additions & 6 deletions src/neptune_fetcher/progress_update_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,36 +98,33 @@ class DefaultProgressUpdateHandler(ProgressUpdateHandler):
def pre_series_fetch(self, total_series: int, series_limit: int) -> None:
from tqdm import tqdm

self._series_bar = tqdm(total=total_series)
self._series_bar = tqdm(total=total_series, desc="Fetching series values", unit=" steps")
self._series_bar.update(n=series_limit)

def pre_runs_table_fetch(self) -> None:
from tqdm import tqdm

self._table_bar = tqdm()
self._table_bar = tqdm(desc="Fetching runs", unit=" runs")

def on_series_fetch(self, step: int) -> None:
self._series_bar.update(n=step)
self._series_bar.set_description("Fetching series values")

def post_series_fetch(self) -> None:
self._series_bar.close()

def on_runs_table_fetch(self, step: int) -> None:
self._table_bar.update(n=step)
self._table_bar.set_description("Fetching runs")

def post_runs_table_fetch(self) -> None:
self._table_bar.close()

def pre_download(self, total_size: int) -> None:
from tqdm import tqdm

self._download_bar = tqdm(total=total_size)
self._download_bar = tqdm(total=total_size, desc="Downloading file", unit="B", unit_scale=True)

def on_download_chunk(self, chunk: int) -> None:
self._download_bar.update(n=chunk)
self._download_bar.set_description("Downloading file")

def post_download(self) -> None:
self._download_bar.close()
Loading