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

cloud/instance with is4gen.8xlarge leads to "ZeroDivisionError: float division by zero" #285

Open
bpetit opened this issue Apr 8, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@bpetit
Copy link
Collaborator

bpetit commented Apr 8, 2024

Bug description

Querying the cloud/instance route with provider AWS and instance = "is4gen.8xlarge" leads to this 500 internal error with this trace:

Traceback (most recent call last):
File "/app/boaviztapi/main.py", line 45, in catch_exceptions_middleware
return await call_next(request)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 84, in call_next
raise app_exc
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/base.py", line 70, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call
raise e
File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "/app/boaviztapi/routers/cloud_router.py", line 50, in instance_cloud_impact
return await cloud_instance_impact(
File "/app/boaviztapi/routers/cloud_router.py", line 107, in cloud_instance_impact
impacts = compute_impacts(model=cloud_instance, selected_criteria=criteria, duration=duration)
File "/app/boaviztapi/service/impacts_computation.py", line 50, in compute_impacts
compute_single_impact(model, phase, criteria.name, duration)
File "/app/boaviztapi/service/impacts_computation.py", line 25, in compute_single_impact
impact, min_impact, max_impact, warnings = impact_function(criteria, duration, model)
File "/app/boaviztapi/service/impacts_computation.py", line 453, in cloud_impact_embedded
default_allocation = cloud_instance.vcpu.value / cloud_instance.platform.get_total_vcpu()
ZeroDivisionError: float division by zero

This seems to be because is4gen.8xlarge server/platform has a value of 0 CPU units :

is4gen.8xlarge,AWS,rack,0,,,Annapurna Labs Graviton2,,6,32,4,7500,0,0,0,,0,2;2;2,2.99;1;5,50;0;100,1,35040,0.33;0.2;0.6,RAM configuration was not verified

As the is4gen.8xlarge instance has 32 vcpus but the server's "Annapurna Labs Graviton2" CPU has 64 logical cores, it seems that the script generating server.csv record sets 0 (maybe a round(32/64) somewhere ?) as CPU.units, which leads to the error.

To Reproduce

Query cloud/instance with provider = aws and instance_type = "is4gen.8xlarge"

Expected behavior

200 OK with a result

@bpetit bpetit added the bug Something isn't working label Apr 8, 2024
@JacobValdemar
Copy link
Contributor

The following instance types produce an Internal Server Error (version 1.2.4):

g3.4xlarge
g3.8xlarge
g3.16xlarge
g3s.xlarge
is4gen.medium
is4gen.large
is4gen.xlarge
is4gen.2xlarge
is4gen.4xlarge
is4gen.8xlarge
m1.medium
m1.small
m1.large
m1.xlarge
m7gd.medium
m7gd.large
m7gd.xlarge
m7gd.2xlarge
m7gd.4xlarge
m7gd.8xlarge
m7gd.12xlarge
m7gd.16xlarge
mac2.metal
ra3.4xlarge
ra3.16xlarge

@bpetit
Copy link
Collaborator Author

bpetit commented Jun 5, 2024

Hi ! it might be a duplicate of #284 :)

The current issue is specifically about a ZeroDivisionError

@JacobValdemar
Copy link
Contributor

Ah, my bad. Thought it was related 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants