zenx 0.7.1__tar.gz → 0.7.3__tar.gz
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.
- {zenx-0.7.1 → zenx-0.7.3}/PKG-INFO +1 -1
- {zenx-0.7.1 → zenx-0.7.3}/pyproject.toml +1 -1
- {zenx-0.7.1 → zenx-0.7.3}/zenx/pipelines/preprocess.py +4 -2
- {zenx-0.7.1 → zenx-0.7.3}/zenx/utils.py +3 -2
- {zenx-0.7.1 → zenx-0.7.3}/zenx.egg-info/PKG-INFO +1 -1
- {zenx-0.7.1 → zenx-0.7.3}/setup.cfg +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/cli.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/clients/__init__.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/clients/database.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/clients/http.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/debug_runner.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/discovery.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/engine.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/exceptions.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/logger.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/pipelines/__init__.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/pipelines/base.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/pipelines/google_rpc.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/pipelines/manager.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/pipelines/websocket.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/resources/proto/__init__.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/resources/proto/feed_pb2.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/resources/proto/feed_pb2_grpc.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/settings.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/spiders/__init__.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx/spiders/base.py +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx.egg-info/SOURCES.txt +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx.egg-info/dependency_links.txt +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx.egg-info/entry_points.txt +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx.egg-info/requires.txt +0 -0
- {zenx-0.7.1 → zenx-0.7.3}/zenx.egg-info/top_level.txt +0 -0
@@ -2,6 +2,7 @@ from typing import Dict
|
|
2
2
|
|
3
3
|
from zenx.pipelines.base import Pipeline
|
4
4
|
from zenx.exceptions import DropItem
|
5
|
+
from zenx.utils import log_processing_time
|
5
6
|
|
6
7
|
|
7
8
|
|
@@ -13,7 +14,8 @@ class PreprocessPipeline(Pipeline):
|
|
13
14
|
async def start(self) -> None:
|
14
15
|
pass
|
15
16
|
|
16
|
-
|
17
|
+
|
18
|
+
@log_processing_time
|
17
19
|
async def process_item(self, item: Dict, spider: str) -> Dict:
|
18
20
|
self.drop_if_scraped_too_late(item)
|
19
21
|
_id = item.get("_id")
|
@@ -23,7 +25,7 @@ class PreprocessPipeline(Pipeline):
|
|
23
25
|
raise DropItem
|
24
26
|
|
25
27
|
scraped_time = item['scraped_at'] - item['responded_at']
|
26
|
-
self.logger.info("scraped", id=item.get("_id"), time_ms=scraped_time
|
28
|
+
self.logger.info("scraped", id=item.get("_id"), time_ms=scraped_time)
|
27
29
|
return item
|
28
30
|
|
29
31
|
|
@@ -13,8 +13,9 @@ def log_processing_time(func):
|
|
13
13
|
async def wrapper(self, item: Dict, spider: str, *args, **kwargs) -> Dict:
|
14
14
|
start_time = get_time()
|
15
15
|
result = await func(self, item, spider, *args, **kwargs)
|
16
|
-
|
17
|
-
|
16
|
+
end_time = get_time()
|
17
|
+
processed_time = end_time - start_time
|
18
|
+
self.logger.info("processed", id=item['_id'], time_ms=processed_time, pipeline=self.name, started_at=start_time, finished_at=end_time)
|
18
19
|
return result
|
19
20
|
return wrapper
|
20
21
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|