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

fix: Fix CPU usage calculation #315

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apify/_platform_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def to_crawlee_format(self) -> EventSystemInfoData:
return EventSystemInfoData.model_validate(
{
'cpu_info': {
'used_ratio': self.cpu_current_usage,
'used_ratio': self.cpu_current_usage / 100,
'created_at': self.created_at,
},
'memory_info': {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_platform_event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,5 @@ def listener(data: Any) -> None:
await asyncio.sleep(0.1)
assert len(event_calls) == 1
assert event_calls[0] is not None
assert event_calls[0]['cpuInfo']['usedRatio'] == 8.45549815498155
assert event_calls[0]['cpuInfo']['usedRatio'] == 0.0845549815498155
event_calls.clear()