Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if parsed memory/scratchsize may be too small #510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

obbardc
Copy link
Member

@obbardc obbardc commented Jul 1, 2024

Since the --memory and --scratchsize arguments are parsed with human-readable suffixes into bytes (e.g 2048MB or 2GB), if a user does not put a suffix the arguments are parsed as bytes which can cause issues later when a user sets the memory to be 2048 assuming it will be parsed as MB.

Change the documentation to match reality and also add a warning if the user has set either parameter less than the recommended default.

Closes: #509

Since the --memory and --scratchsize arguments are parsed with human-readable
suffixes into bytes (e.g 2048MB or 2GB), if a user does not put a suffix
the arguments are parsed as bytes which can cause issues later when a user
sets the memory to be 2048 assuming it will be parsed as MB.

Change the documentation to match reality and also add a warning if the user
has set either parameter less than the recommended default.

Closes: #509
Signed-off-by: Christopher Obbard <[email protected]>
@obbardc obbardc force-pushed the wip/obbardc/debos-warn-low-size branch from 4ba7ea3 to 13f6822 Compare July 1, 2024 10:54
@obbardc obbardc requested a review from sjoerdsimons July 1, 2024 10:54
@daissi
Copy link
Contributor

daissi commented Nov 14, 2024

Something is wrong with --scratchsize:

./debos ../debos-recipes/rpi3/debimage-rpi3.yaml --scratchsize 100MB -m 100MB
2024/11/14 18:35:32 WARNING: Memory size of 100MB is less than recommended 2048MB
2024/11/14 18:35:32 WARNING: Scratch size of 95MB is less than recommended 2048MB

While is works for --memory, the conversion for scratchsize doesn't give us the same value 100MB vs 95MB

@obbardc
Copy link
Member Author

obbardc commented Nov 14, 2024

Something is wrong with --scratchsize:

./debos ../debos-recipes/rpi3/debimage-rpi3.yaml --scratchsize 100MB -m 100MB
2024/11/14 18:35:32 WARNING: Memory size of 100MB is less than recommended 2048MB
2024/11/14 18:35:32 WARNING: Scratch size of 95MB is less than recommended 2048MB

While is works for --memory, the conversion for scratchsize doesn't give us the same value 100MB vs 95MB

I guess that is because for scratchsize we convert to bytes with units.FromHumanSize but for memory we do not :-).

Perhaps we should unify this by:

  1. using units.FromHumanSize to convert for both scratchsize & memory.
  2. convert to MB using forumula / 1000 / 1000 for both variables instead of / 1024 / 1024. That should make the printed number the same.

To be honest, I threw this together quickly just for some feedback. Happy to rework it.

@daissi
Copy link
Contributor

daissi commented Nov 15, 2024

I would say let's use for both units.FromHumanSize for consistency :) This should avoid confusion.

@obbardc obbardc changed the title debos: Warn if parsed memory/scratchsize may be too small Warn if parsed memory/scratchsize may be too small Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using "--memory" breaks fakemachine backend
2 participants