cobweb-launcher 1.2.21__py3-none-any.whl → 1.2.23__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 cobweb-launcher might be problematic. Click here for more details.
- cobweb/db/api_db.py +18 -12
- cobweb/launchers/launcher_api.py +8 -7
- {cobweb_launcher-1.2.21.dist-info → cobweb_launcher-1.2.23.dist-info}/METADATA +1 -1
- {cobweb_launcher-1.2.21.dist-info → cobweb_launcher-1.2.23.dist-info}/RECORD +7 -7
- {cobweb_launcher-1.2.21.dist-info → cobweb_launcher-1.2.23.dist-info}/LICENSE +0 -0
- {cobweb_launcher-1.2.21.dist-info → cobweb_launcher-1.2.23.dist-info}/WHEEL +0 -0
- {cobweb_launcher-1.2.21.dist-info → cobweb_launcher-1.2.23.dist-info}/top_level.txt +0 -0
cobweb/db/api_db.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import json
|
|
2
1
|
import os
|
|
2
|
+
import json
|
|
3
3
|
import requests
|
|
4
4
|
|
|
5
5
|
|
|
@@ -9,19 +9,25 @@ class ApiDB:
|
|
|
9
9
|
self.host = host or os.getenv("REDIS_API_HOST", "http://127.0.0.1:4396")
|
|
10
10
|
|
|
11
11
|
def _get_response(self, api, params: dict = None):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
try:
|
|
13
|
+
url = self.host + api
|
|
14
|
+
response = requests.get(url, params=params)
|
|
15
|
+
json_data = response.json()
|
|
16
|
+
response.close()
|
|
17
|
+
return json_data["data"]
|
|
18
|
+
except:
|
|
19
|
+
return None
|
|
17
20
|
|
|
18
21
|
def _post_response(self, api, params: dict = None, data: dict = None):
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
try:
|
|
23
|
+
url = self.host + api
|
|
24
|
+
headers = {"Content-Type": "application/json"}
|
|
25
|
+
response = requests.post(url, headers=headers, params=params, data=json.dumps(data))
|
|
26
|
+
json_data = response.json()
|
|
27
|
+
response.close()
|
|
28
|
+
return json_data["data"]
|
|
29
|
+
except:
|
|
30
|
+
return None
|
|
25
31
|
|
|
26
32
|
def get(self, name):
|
|
27
33
|
return self._get_response(api="/get", params=dict(name=name))
|
cobweb/launchers/launcher_api.py
CHANGED
|
@@ -73,11 +73,12 @@ class LauncherApi(Launcher):
|
|
|
73
73
|
if self.heartbeat else "-inf"
|
|
74
74
|
|
|
75
75
|
self._db.members(self._todo_key, 0, _min=_min, _max="(0")
|
|
76
|
-
self._db.delete(self._reset_lock_key)
|
|
77
76
|
|
|
78
77
|
if not self.heartbeat:
|
|
79
78
|
self._heartbeat_start_event.set()
|
|
80
79
|
|
|
80
|
+
self._db.delete(self._reset_lock_key)
|
|
81
|
+
|
|
81
82
|
time.sleep(reset_wait_seconds)
|
|
82
83
|
|
|
83
84
|
@check_pause
|
|
@@ -149,9 +150,9 @@ class LauncherApi(Launcher):
|
|
|
149
150
|
|
|
150
151
|
if seed_info["count"]:
|
|
151
152
|
|
|
152
|
-
succeed_count = self._db.zrem(self._todo_key, *seed_info["common"])
|
|
153
|
-
succeed_count += self._db.done([self._todo_key, self._done_key], *seed_info["succeed"])
|
|
154
|
-
failed_count = self._db.done([self._todo_key, self._fail_key], *seed_info["failed"])
|
|
153
|
+
succeed_count = int(self._db.zrem(self._todo_key, *seed_info["common"]) or 0)
|
|
154
|
+
succeed_count += int(self._db.done([self._todo_key, self._done_key], *seed_info["succeed"]) or 0)
|
|
155
|
+
failed_count = int(self._db.done([self._todo_key, self._fail_key], *seed_info["failed"]) or 0)
|
|
155
156
|
|
|
156
157
|
if failed_count:
|
|
157
158
|
self.statistics(self._statistics_fail_key, failed_count)
|
|
@@ -208,9 +209,9 @@ class LauncherApi(Launcher):
|
|
|
208
209
|
doing_len=len(self.__DOING__.keys()),
|
|
209
210
|
todo_len=self.__LAUNCHER_QUEUE__['todo'].length,
|
|
210
211
|
done_len=self.__LAUNCHER_QUEUE__['done'].length,
|
|
211
|
-
redis_seed_count=self._db.zcount(self._todo_key, "-inf", "+inf"),
|
|
212
|
-
redis_todo_len=self._db.zcount(self._todo_key, 0, "(1000"),
|
|
213
|
-
redis_doing_len=self._db.zcount(self._todo_key, "-inf", "(0"),
|
|
212
|
+
redis_seed_count=self._db.zcount(self._todo_key, "-inf", "+inf") or "error",
|
|
213
|
+
redis_todo_len=self._db.zcount(self._todo_key, 0, "(1000") or "error",
|
|
214
|
+
redis_doing_len=self._db.zcount(self._todo_key, "-inf", "(0") or "error",
|
|
214
215
|
upload_len=self.__LAUNCHER_QUEUE__['upload'].length,
|
|
215
216
|
))
|
|
216
217
|
|
|
@@ -14,14 +14,14 @@ cobweb/crawlers/base_crawler.py,sha256=ee_WSDnPQpPTk6wlFuY2UEx5L3hcsAZFcr6i3GLSr
|
|
|
14
14
|
cobweb/crawlers/crawler.py,sha256=xiFNM0t69f5xlm59hPbO2MpqtdirVAUhD84-CLpyHPM,6349
|
|
15
15
|
cobweb/crawlers/file_crawler.py,sha256=2Sjbdgxzqd41WykKUQE3QQlGai3T8k-pmHNmPlTchjQ,4454
|
|
16
16
|
cobweb/db/__init__.py,sha256=uZwSkd105EAwYo95oZQXAfofUKHVIAZZIPpNMy-hm2Q,56
|
|
17
|
-
cobweb/db/api_db.py,sha256=
|
|
17
|
+
cobweb/db/api_db.py,sha256=bDc5dJQxq4z04h70KUTHd0OqUOEY7Cm3wcNJZtTvJIM,3015
|
|
18
18
|
cobweb/db/redis_db.py,sha256=fumNZJiio-uQqRcSrymx8eJ1PqsdOwITe_Y-9JOXxrQ,4298
|
|
19
19
|
cobweb/exceptions/__init__.py,sha256=E9SHnJBbhD7fOgPFMswqyOf8SKRDrI_i25L0bSpohvk,32
|
|
20
20
|
cobweb/exceptions/oss_db_exception.py,sha256=iP_AImjNHT3-Iv49zCFQ3rdLnlvuHa3h2BXApgrOYpA,636
|
|
21
21
|
cobweb/launchers/__init__.py,sha256=qMuVlQcjErVK67HyKFZEsXf_rfZD5ODjx1QucSCKMOM,114
|
|
22
22
|
cobweb/launchers/launcher.py,sha256=SK4f3Fpuv-QMMriHruXGQ1sh1lxT1DZ2PdG0p2wAzNw,6978
|
|
23
23
|
cobweb/launchers/launcher_air.py,sha256=KAk_M8F3029cXYe7m4nn3Nzyi89lbxJ2cqZjqW8iZ0E,2832
|
|
24
|
-
cobweb/launchers/launcher_api.py,sha256=
|
|
24
|
+
cobweb/launchers/launcher_api.py,sha256=doJ17v6DXiLB-xTfWK1giQ4MNRzuhFUpLXx7Ec7r9zg,8702
|
|
25
25
|
cobweb/launchers/launcher_pro.py,sha256=2JdN4khAFGBWLXDKaWknjG72XBhfTAnwtrgVmkF0K3M,8653
|
|
26
26
|
cobweb/pipelines/__init__.py,sha256=zSUsGtx6smbs2iXBXvYynReKSgky-3gjqaAtKVnA_OU,105
|
|
27
27
|
cobweb/pipelines/base_pipeline.py,sha256=fYnWf79GmhufXpcnMa3te18SbmnVeYLwxfyo-zLd9CY,1577
|
|
@@ -33,8 +33,8 @@ cobweb/utils/__init__.py,sha256=vBtZTy3EfRE0MmH43URhmr7nw6_oOWTEbGOM9xR_9o8,78
|
|
|
33
33
|
cobweb/utils/bloom.py,sha256=vng-YbKgh9HbtpAWYf_nkUSbfVTOj40aqUUejRYlsCU,1752
|
|
34
34
|
cobweb/utils/oss.py,sha256=gyt8-UB07tVphZLQXMOf-JTJwU-mWq8KZkOXKkAf3uk,3513
|
|
35
35
|
cobweb/utils/tools.py,sha256=5JEaaAwYoV9Sdla2UBIJn6faUBuXmxUMagm9ck6FVqs,1253
|
|
36
|
-
cobweb_launcher-1.2.
|
|
37
|
-
cobweb_launcher-1.2.
|
|
38
|
-
cobweb_launcher-1.2.
|
|
39
|
-
cobweb_launcher-1.2.
|
|
40
|
-
cobweb_launcher-1.2.
|
|
36
|
+
cobweb_launcher-1.2.23.dist-info/LICENSE,sha256=z1rxSIGOyzcSb3orZxFPxzx-0C1vTocmswqBNxpKfEk,1063
|
|
37
|
+
cobweb_launcher-1.2.23.dist-info/METADATA,sha256=qnhBqjrdIuXM7fRz3vOV_jwFLydD5eoe1QJ88bG_yMk,6510
|
|
38
|
+
cobweb_launcher-1.2.23.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
|
|
39
|
+
cobweb_launcher-1.2.23.dist-info/top_level.txt,sha256=4GETBGNsKqiCUezmT-mJn7tjhcDlu7nLIV5gGgHBW4I,7
|
|
40
|
+
cobweb_launcher-1.2.23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|