Skip to content

Commit

Permalink
fix: id+key reporting in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Jul 28, 2024
1 parent 47cec93 commit d9ee425
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Expand the list of exceptions on which we should retry for HTTP ([#195](https://github.com/stac-utils/stac-asset/pull/195))
- `SkipAssetDownload` docstring ([#199](https://github.com/stac-utils/stac-asset/pull/199))
- Fast failing when we hit `max_concurrent_downloads` ([#204](https://github.com/stac-utils/stac-asset/pull/204))
- Id+key reporting in CLI ([#206](https://github.com/stac-utils/stac-asset/pull/206))

## [0.4.1] - 2024-07-17

Expand Down
12 changes: 6 additions & 6 deletions src/stac_asset/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ async def report_progress(messages: Optional[MessageQueue]) -> None:
unit_divisor=1024,
)
sizes = dict()
owners = dict()
ids = dict()
assets = 0
done = 0
errors = 0
Expand All @@ -352,7 +352,9 @@ async def report_progress(messages: Optional[MessageQueue]) -> None:
if isinstance(message, StartAssetDownload):
assets += 1
if message.owner_id:
owners[message.key] = message.owner_id
ids[message.href] = f"{message.owner_id}[{message.key}]"
else:
ids[message.href] = f"[{message.key}]"
progress_bar.set_description(f"{done}/{assets}")
elif isinstance(message, OpenUrl):
if message.size:
Expand All @@ -376,10 +378,8 @@ async def report_progress(messages: Optional[MessageQueue]) -> None:
progress_bar.update(n)
progress_bar.set_postfix_str(f"{errors} errors, {skips} skips")
progress_bar.set_description_str(f"{done}/{assets}")
if message.key in owners:
name = f"{owners[message.key]}[{message.key}]"
else:
name = f"[{message.key}]"
if message.href in ids:
name = ids[message.href]
progress_bar.write(
f"ERROR: {name} - {type(message.error).__name__}: {message.error}",
file=sys.stderr,
Expand Down

0 comments on commit d9ee425

Please sign in to comment.