Skip to content

Commit c5a0865

Browse files
authored
Merge branch 'master' into rm-remnants-of-scripts-folder
2 parents c36c556 + a224d80 commit c5a0865

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/apify/_platform_event_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def to_crawlee_format(self) -> EventSystemInfoData:
4949
return EventSystemInfoData.model_validate(
5050
{
5151
'cpu_info': {
52-
'used_ratio': self.cpu_current_usage,
52+
'used_ratio': self.cpu_current_usage / 100,
5353
'created_at': self.created_at,
5454
},
5555
'memory_info': {

src/apify/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
@ignore_docs
20-
class ActorLogFormatter(CrawleeLogFormatter): # noqa: D101 Inherited from parent class
20+
class ActorLogFormatter(CrawleeLogFormatter): # noqa: D101 (Inherited from parent class)
2121
pass
2222

2323

tests/unit/test_platform_event_manager.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ def event_handler(data: Any) -> None:
7575

7676
dummy_persist_state = Mock()
7777

78-
# Test that they all work, and that they're called in order
78+
# Test that they all work
7979
event_manager.emit(event=Event.PERSIST_STATE, event_data=dummy_persist_state)
8080
await asyncio.sleep(0.1)
81-
assert event_calls[Event.PERSIST_STATE] == [
81+
assert set(event_calls[Event.PERSIST_STATE]) == {
8282
(1, dummy_persist_state),
8383
(2, dummy_persist_state),
8484
(3, dummy_persist_state),
85-
]
85+
}
8686
event_calls[Event.PERSIST_STATE].clear()
8787

8888
# Test that if you remove one, the others stay
8989
event_manager.off(event=Event.PERSIST_STATE, listener=handler_persist_state_3)
9090
event_manager.emit(event=Event.PERSIST_STATE, event_data=dummy_persist_state)
9191
await asyncio.sleep(0.1)
92-
assert event_calls[Event.PERSIST_STATE] == [
92+
assert set(event_calls[Event.PERSIST_STATE]) == {
9393
(1, dummy_persist_state),
9494
(2, dummy_persist_state),
95-
]
95+
}
9696
event_calls[Event.PERSIST_STATE].clear()
9797

9898
# Test that removing all in bulk works
@@ -200,5 +200,5 @@ def listener(data: Any) -> None:
200200
await asyncio.sleep(0.1)
201201
assert len(event_calls) == 1
202202
assert event_calls[0] is not None
203-
assert event_calls[0]['cpuInfo']['usedRatio'] == 8.45549815498155
203+
assert event_calls[0]['cpuInfo']['usedRatio'] == 0.0845549815498155
204204
event_calls.clear()

0 commit comments

Comments
 (0)