question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatic units in monitor for large quantities

See original GitHub issue

Would it be possible to support automatic unit conversion, similar to how tqdm implements this?

  • unit : str, optional String that will be used to define the unit of each iteration [default: it].
  • unit_scale : bool or int or float, optional If 1 or True, the number of iterations will be reduced/scaled automatically and a metric prefix following the International System of Units standard will be added (kilo, mega, etc.) [default: False]. If any other non-zero number, will scale total and n.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
rsalmeicommented, Jul 28, 2022

Hey @Jasonzyt, not yet, I couldn’t even commit it yet! It’s still all on my laptop here, but it is completely ready. I’ll try to finalize it asap 👍

1reaction
jhonatan-lopescommented, Apr 29, 2022

Hi @rsalmei, I see what you mean, but consider the following scenarios:

  1. I am counting something (say S units) that I don’t care much about the specific number, just a rough idea would be fine. Since it goes into thousands/millions, I am fine with an auto-scaling. Therefore, I use unit=S and wish that it auto-scales 1850000S to 1.85MS. In this case, alive-bar must default to auto-scaling and a 1000 unit scale parameter, i.e. a kilo-unit means 1000 of that unit.

  2. I want to configure the bar to display bytes downloaded. This scenario is quite similar to the one above, except that unit_scale=1024. You could code the unit parameter to scale to 1024 when unit=B or unit=b, but I think that it loses generality.

  3. I want to configure the bar to display an iteration counter that goes up to thousands. Maybe in this case I want to actually see at which iteration I am at a given moment with precision, so unit=it (for iterations) but unit_scale=1 meaning that I don’t want it to scale with SI prefixes. In this case I actually want to see 1850000 it.

With all that said, I do think that the two configurations are needed, both unit and unit_scale, especially since the user can wish to scale with esoteric bases/factors other than 10 and 2.

It could be that the default is that when unit is given and unit_scale is not, it assumes base 10 and auto-scaling with SI-prefixes.

What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Large Cuff Blood Pressure Monitor for Big Arms, 5.56 ...
Large Cuff Blood Pressure Monitor for Big Arms, 5.56-18.96 Inche XL Size Automatic Blood Pressure Machine for Adult, Measuring BP & Heart Rate...
Read more >
Configure Monitors - Datadog Docs
Alerts are grouped automatically based on your selection of the group by step when defining your query. Grouping defaults to Simple Alert ....
Read more >
Monitor: Automatic intelligent inspection for hardware ...
For this use case, Monitor examines every new unit on the line, compares it to normal past units, and triages anything unusual for...
Read more >
Blood Pressure Monitors & Cuffs - Omron Healthcare
Nearly 1 out of every 2 adults in the United States has high blood pressure, but you can help get to the heart...
Read more >
SIMATIC Industrial Monitors and Thin Clients - Siemens
Distance from IPC: up to 5 m (Standard), up to 100 m with HDBaseT module (Extended) or Ethernet cable (Ethernet) · Extremely high-quality,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found