apify 2.5.0b4__py3-none-any.whl → 2.5.0b6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of apify might be problematic. Click here for more details.
- apify/_configuration.py +15 -2
- apify/_platform_event_manager.py +3 -3
- {apify-2.5.0b4.dist-info → apify-2.5.0b6.dist-info}/METADATA +1 -1
- {apify-2.5.0b4.dist-info → apify-2.5.0b6.dist-info}/RECORD +6 -6
- {apify-2.5.0b4.dist-info → apify-2.5.0b6.dist-info}/WHEEL +0 -0
- {apify-2.5.0b4.dist-info → apify-2.5.0b6.dist-info}/licenses/LICENSE +0 -0
apify/_configuration.py
CHANGED
|
@@ -5,8 +5,8 @@ from decimal import Decimal
|
|
|
5
5
|
from logging import getLogger
|
|
6
6
|
from typing import Annotated, Any
|
|
7
7
|
|
|
8
|
-
from pydantic import AliasChoices, BeforeValidator, Field
|
|
9
|
-
from typing_extensions import deprecated
|
|
8
|
+
from pydantic import AliasChoices, BeforeValidator, Field, model_validator
|
|
9
|
+
from typing_extensions import Self, deprecated
|
|
10
10
|
|
|
11
11
|
from crawlee._utils.models import timedelta_ms
|
|
12
12
|
from crawlee._utils.urls import validate_http_url
|
|
@@ -365,6 +365,19 @@ class Configuration(CrawleeConfiguration):
|
|
|
365
365
|
),
|
|
366
366
|
] = None
|
|
367
367
|
|
|
368
|
+
@model_validator(mode='after')
|
|
369
|
+
def disable_browser_sandbox_on_platform(self) -> Self:
|
|
370
|
+
"""Disable the browser sandbox mode when running on the Apify platform.
|
|
371
|
+
|
|
372
|
+
Running in environment where `is_at_home` is True does not benefit from browser sandbox as it is already running
|
|
373
|
+
in a container. It can be on the contrary undesired as the process in the container might be running as root and
|
|
374
|
+
this will crash chromium that was started with browser sandbox mode.
|
|
375
|
+
"""
|
|
376
|
+
if self.is_at_home and not self.disable_browser_sandbox:
|
|
377
|
+
self.disable_browser_sandbox = True
|
|
378
|
+
logger.warning('Actor is running on the Apify platform, `disable_browser_sandbox` was changed to True.')
|
|
379
|
+
return self
|
|
380
|
+
|
|
368
381
|
@classmethod
|
|
369
382
|
def get_global_configuration(cls) -> Configuration:
|
|
370
383
|
"""Retrieve the global instance of the configuration.
|
apify/_platform_event_manager.py
CHANGED
|
@@ -48,11 +48,11 @@ class SystemInfoEventData(BaseModel):
|
|
|
48
48
|
is_cpu_overloaded: Annotated[bool, Field(alias='isCpuOverloaded')]
|
|
49
49
|
created_at: Annotated[datetime, Field(alias='createdAt')]
|
|
50
50
|
|
|
51
|
-
def to_crawlee_format(self) -> EventSystemInfoData:
|
|
51
|
+
def to_crawlee_format(self, dedicated_cpus: float) -> EventSystemInfoData:
|
|
52
52
|
return EventSystemInfoData.model_validate(
|
|
53
53
|
{
|
|
54
54
|
'cpu_info': {
|
|
55
|
-
'used_ratio': self.cpu_current_usage / 100,
|
|
55
|
+
'used_ratio': (self.cpu_current_usage / 100) / dedicated_cpus,
|
|
56
56
|
'created_at': self.created_at,
|
|
57
57
|
},
|
|
58
58
|
'memory_info': {
|
|
@@ -218,7 +218,7 @@ class PlatformEventManager(EventManager):
|
|
|
218
218
|
event=parsed_message.name,
|
|
219
219
|
event_data=parsed_message.data
|
|
220
220
|
if not isinstance(parsed_message.data, SystemInfoEventData)
|
|
221
|
-
else parsed_message.data.to_crawlee_format(),
|
|
221
|
+
else parsed_message.data.to_crawlee_format(self._config.dedicated_cpus or 1),
|
|
222
222
|
)
|
|
223
223
|
|
|
224
224
|
if parsed_message.name == Event.MIGRATING:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
apify/__init__.py,sha256=HpgKg2FZWJuSPfDygzJ62psylhw4NN4tKFnoYUIhcd4,838
|
|
2
2
|
apify/_actor.py,sha256=k6N1-A9ziheA4z9XuNx9ddJ0EG3g-KGU_Dsy--hiPng,49704
|
|
3
3
|
apify/_charging.py,sha256=m7hJIQde4M7vS4g_4hsNRP5xHNXjYQ8MyqOEGeNb7VY,12267
|
|
4
|
-
apify/_configuration.py,sha256=
|
|
4
|
+
apify/_configuration.py,sha256=AVztnlaBkHxBs0VkLIUhFHWwvlgHY-koMNUc0aqw9ZI,11908
|
|
5
5
|
apify/_consts.py,sha256=_Xq4hOfOA1iZ3n1P967YWdyncKivpbX6RTlp_qanUoE,330
|
|
6
6
|
apify/_crypto.py,sha256=8BgeQC0ZhYP5KdmLxxLQAW87Gq-Z4HlREbYGXr46w0U,6607
|
|
7
7
|
apify/_models.py,sha256=-Y0rljBJWxMMCp8iDCTG4UV3bEvNZzp-kx2SYbPfeIY,7919
|
|
8
|
-
apify/_platform_event_manager.py,sha256=
|
|
8
|
+
apify/_platform_event_manager.py,sha256=igi9dRTfB7t0mRBM1bCfzMh7RBbr5adrJ0iRymUQ8S8,7990
|
|
9
9
|
apify/_proxy_configuration.py,sha256=c-O6_PZ9pUD-i4J0RFEKTtfyJPP2rTRJJA1TH8NVsV8,13189
|
|
10
10
|
apify/_utils.py,sha256=7YL7VhmNND0XARsXtPQWWQCyK4825n-ZVB8n9cgWm0A,1838
|
|
11
11
|
apify/log.py,sha256=j-E4t-WeA93bc1NCQRG8sTntehQCiiN8ia-MdQe3_Ts,1291
|
|
@@ -38,7 +38,7 @@ apify/scrapy/pipelines/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
38
38
|
apify/storages/__init__.py,sha256=FW-z6ubuPnHGM-Wp15T8mR5q6lnpDGrCW-IkgZd5L30,177
|
|
39
39
|
apify/storages/_request_list.py,sha256=FCC4X2MX2V8vLZBCUi5Q1qg9w62y9UkF4ptOqyPVhG8,6052
|
|
40
40
|
apify/storages/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
-
apify-2.5.
|
|
42
|
-
apify-2.5.
|
|
43
|
-
apify-2.5.
|
|
44
|
-
apify-2.5.
|
|
41
|
+
apify-2.5.0b6.dist-info/METADATA,sha256=SN3PT2KU7FLCO1jsNZQ7JiDAzepGdblAs9yMGEVVUsY,21558
|
|
42
|
+
apify-2.5.0b6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
43
|
+
apify-2.5.0b6.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
|
|
44
|
+
apify-2.5.0b6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|