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

PowerHog Data can contain NaN values #906

Closed
ArneTR opened this issue Sep 18, 2024 · 4 comments · May be fixed by #897
Closed

PowerHog Data can contain NaN values #906

ArneTR opened this issue Sep 18, 2024 · 4 comments · May be fixed by #897
Assignees

Comments

@ArneTR
Copy link
Member

ArneTR commented Sep 18, 2024

Currently very many API submissions for the PowerHog data fail because there are NaN values in the data.

I sent you, @ribalba, the detailed dump via email, since it contains sensitive information.

Here an excerpt from the dump to spot the location:

... 
 "gpu": {"freq_hz": 0.0, "idle_ns": 0, "idle_ratio": NaN, "dvfm_states": [{"freq": 389, "used_ns": 0, "used_ratio": 0.0}, {"freq": 486, "used_ns": 0, "used_ratio": 0.0}, {"freq": 648, "used_ns": 0, "used_ratio": 0.0}, {"freq": 778, "used_ns": 0, "used_ratio": 0.0}, {"freq": 972, "used_ns": 0, "used_ratio": 0.0}, {"freq": 1296, "used_ns": 0, "used_ratio": 0.0}], "sw_requested_state": [{"sw_req_state": "P1", "used_ns": 0, "used_ratio": 0.0}, {"sw_req_state": "P2", "used_ns": 0, "used_ratio": 0.0}, {"sw_req_state": "P3", "used_ns": 0, "used_ratio": 0.0}, {"sw_req_state": "P4", "used_ns": 0, "used_ratio": 0.0}, {"sw_req_state": "P5", "used_ns": 0, "used_ratio": 0.0}, {"sw_req_state": "P6", "used_ns": 0, "used_ratio": 0.0}], "sw_state": [{"sw_state": "SW_P1", "used_ns": 0, "used_ratio": 0.0}, {"sw_state": "SW_P2", "used_ns": 0, "used_ratio": 0.0}, {"sw_state": "SW_P3", "used_ns": 0, "used_ratio": 0.0}, {"sw_state": "SW_P4", "used_ns": 0, "used_ratio": 0.0}, {"sw_state": "SW_P5", "used_ns": 0, "used_ratio": 0.0}, {"sw_state": "SW_P6", "used_ns": 0, "used_ratio": 0.0}], "gpu_energy": 0}, "timezone": ["CET", "CEST"]}'

In general I think however the whole data has to be checked to be valida JSON before being sent.

@ArneTR ArneTR linked a pull request Sep 18, 2024 that will close this issue
@ArneTR
Copy link
Member Author

ArneTR commented Sep 19, 2024

On second notice I am not so sure that this is really the underlying problem. ORJSON can convert NaN values fine, as long as they are not a dictionary key.

See:

orjson.dumps({"asd": numpy.NaN}) 
# => {"asd": null}

@ribalba
Copy link
Member

ribalba commented Sep 25, 2024

So I can't reproduce.

import base64
import zlib
import orjson

with open('/tmp/dump.txt', 'r', encoding='utf-8') as file:
    filecontent = file.read()

decoded_data = base64.b64decode(filecontent)
decompressed_data = zlib.decompress(decoded_data)
print(decompressed_data)
measurement_data = orjson.loads(decompressed_data.decode())
print(measurement_data)

with the dump.txt containing the data you sent me works fine. And I can't find an NaN value.

@ArneTR
Copy link
Member Author

ArneTR commented Sep 26, 2024

please check the newest email from yesterday afternoon

@ArneTR
Copy link
Member Author

ArneTR commented Sep 27, 2024

closed via green-coding-solutions/hog#29

@ArneTR ArneTR closed this as completed Sep 27, 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 a pull request may close this issue.

2 participants