zenx 0.7.9__py3-none-any.whl → 0.8.1__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.
- zenx/engine.py +1 -0
- zenx/pipelines/manager.py +8 -2
- {zenx-0.7.9.dist-info → zenx-0.8.1.dist-info}/METADATA +1 -1
- {zenx-0.7.9.dist-info → zenx-0.8.1.dist-info}/RECORD +7 -7
- {zenx-0.7.9.dist-info → zenx-0.8.1.dist-info}/WHEEL +0 -0
- {zenx-0.7.9.dist-info → zenx-0.8.1.dist-info}/entry_points.txt +0 -0
- {zenx-0.7.9.dist-info → zenx-0.8.1.dist-info}/top_level.txt +0 -0
zenx/engine.py
CHANGED
@@ -61,6 +61,7 @@ class Engine:
|
|
61
61
|
if self.shutdown_event.is_set():
|
62
62
|
logger.info("shutdown", spider=spider_name)
|
63
63
|
if spider.background_tasks:
|
64
|
+
logger.debug("waiting", background_tasks=len(spider.background_tasks), belong_to="spider")
|
64
65
|
await asyncio.gather(*spider.background_tasks)
|
65
66
|
await client.close()
|
66
67
|
await db.close()
|
zenx/pipelines/manager.py
CHANGED
@@ -16,7 +16,8 @@ class PipelineManager:
|
|
16
16
|
self.pipelines = {name:Pipeline.get_pipeline(name)(logger, db, settings) for name in pipeline_names}
|
17
17
|
self.settings = settings
|
18
18
|
self._fire_and_forget_pipelines = [p for p in self.pipelines.values() if p.name != "preprocess"]
|
19
|
-
|
19
|
+
self._background_tasks = set()
|
20
|
+
|
20
21
|
|
21
22
|
async def start_pipelines(self) -> None:
|
22
23
|
""" connect and monitor """
|
@@ -36,9 +37,14 @@ class PipelineManager:
|
|
36
37
|
self.logger.exception("process_item", item=item, pipeline=preprocess_pipeline.name)
|
37
38
|
raise
|
38
39
|
for pipeline in self._fire_and_forget_pipelines:
|
39
|
-
asyncio.create_task(pipeline.process_item(item, spider))
|
40
|
+
t = asyncio.create_task(pipeline.process_item(item, spider))
|
41
|
+
self._background_tasks.add(t)
|
42
|
+
t.add_done_callback(self._background_tasks.discard)
|
40
43
|
|
41
44
|
|
42
45
|
async def close_pipelines(self) -> None:
|
46
|
+
if self._background_tasks:
|
47
|
+
self.logger.debug("waiting", background_tasks=len(self._background_tasks), belong_to="pipeline_manager")
|
48
|
+
await asyncio.gather(*self._background_tasks)
|
43
49
|
for pipeline in self.pipelines.values():
|
44
50
|
await pipeline.close()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
zenx/cli.py,sha256=pHKhOTdqI6NQQoYK91waRIMpxCXLYtXEryzVaTbmvqc,2810
|
2
2
|
zenx/debug_runner.py,sha256=B2Jd9A4_EHDa-ohLcwnFIxOV73FagTWXX2fl3qgwlpY,809
|
3
3
|
zenx/discovery.py,sha256=YANVGzy2IG1fYruUud-11Y-ynyO6iEp3EjlHnhIQJQI,1014
|
4
|
-
zenx/engine.py,sha256=
|
4
|
+
zenx/engine.py,sha256=CYwvmPSaI1lC-y_DfuOzX_1Ii14fxU8IdfMM7AIrUUU,2551
|
5
5
|
zenx/exceptions.py,sha256=BJXxzwwX2CU6inhppfblx8c8Z6Mhvsk7MAhQ1LAnhBg,37
|
6
6
|
zenx/logger.py,sha256=UmEk0vV1mSCozV7z_DDgCCXdAManDr5wgkrhKiRQtyU,1651
|
7
7
|
zenx/settings.py,sha256=0RLeKcqHJdD1vuYIQtGeXkp2YIvv3tNyz9O8jw620VQ,1008
|
@@ -12,7 +12,7 @@ zenx/clients/http.py,sha256=fb6COYot6vidNFRBWgoU6CYEfnYWJP0JuVkydvxsHb4,5700
|
|
12
12
|
zenx/pipelines/__init__.py,sha256=IxkZ0UpEJdYjLdd-PMcC9PzzzArTBNNcpgKc7NiOe5Y,131
|
13
13
|
zenx/pipelines/base.py,sha256=N_388z5DFMeaU6wMwcClZAbQFWKh4kpAF7eUJhpQevs,1863
|
14
14
|
zenx/pipelines/google_rpc.py,sha256=8DGcUlE6Th39XgD7WMMxqBMhUkH0kr3l9-cN_1x4CY4,4610
|
15
|
-
zenx/pipelines/manager.py,sha256=
|
15
|
+
zenx/pipelines/manager.py,sha256=lm2A_4h8NNdurFfwrrLwx5Z1tqJ9yZp2qgYvwGWd1lc,2017
|
16
16
|
zenx/pipelines/preprocess.py,sha256=zXuhaLdH5KfBi_Bf-K5BgzFEujdmPWWpwYKkpOifT5U,816
|
17
17
|
zenx/pipelines/websocket.py,sha256=jkRp5a6ro3q2JPAm8qtZWnf0EzFFUFOQgzgSxURXTvk,4359
|
18
18
|
zenx/resources/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -20,8 +20,8 @@ zenx/resources/proto/feed_pb2.py,sha256=ZyICOLnyuXekkvV4bAHZ1nE1-wwzcYYRRrmRJCMr
|
|
20
20
|
zenx/resources/proto/feed_pb2_grpc.py,sha256=Mim6FfBgIMj0PmTqHk036nVUMJH3A6I3ts6r1j3bQF8,7441
|
21
21
|
zenx/spiders/__init__.py,sha256=rs5LuqdM2MQlUYiTGJrzkYhzN8_SSLTrR7wGjSRrrSo,25
|
22
22
|
zenx/spiders/base.py,sha256=BGxOvNnjaz6gmZm7NIgYc0RddWDmpIp53ukxprUUd-Y,1932
|
23
|
-
zenx-0.
|
24
|
-
zenx-0.
|
25
|
-
zenx-0.
|
26
|
-
zenx-0.
|
27
|
-
zenx-0.
|
23
|
+
zenx-0.8.1.dist-info/METADATA,sha256=LOXt2oFxxR1Q66CIzM0qh1nV_zy4JwhOXnzNizUGZnA,1273
|
24
|
+
zenx-0.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
25
|
+
zenx-0.8.1.dist-info/entry_points.txt,sha256=8JXob2f1VtvzGFris-e9Usqywg7oca-cChDlH9moOZU,38
|
26
|
+
zenx-0.8.1.dist-info/top_level.txt,sha256=JeXwvK86d7sB-2x-avugFnZIZa33zaHWKI8RHWJR6KY,5
|
27
|
+
zenx-0.8.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|