cobweb-launcher 1.2.8__tar.gz → 1.2.10__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.
Potentially problematic release.
This version of cobweb-launcher might be problematic. Click here for more details.
- {cobweb-launcher-1.2.8/cobweb_launcher.egg-info → cobweb-launcher-1.2.10}/PKG-INFO +1 -1
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/launchers/launcher.py +1 -1
- cobweb-launcher-1.2.10/cobweb/pipelines/pipeline.py +68 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10/cobweb_launcher.egg-info}/PKG-INFO +1 -1
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/setup.py +1 -1
- cobweb-launcher-1.2.8/cobweb/pipelines/pipeline.py +0 -60
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/LICENSE +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/README.md +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/common_queue.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/decorators.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/item.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/log.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/request.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/response.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/base/seed.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/constant.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/crawlers/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/crawlers/crawler.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/db/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/db/redis_db.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/exceptions/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/exceptions/oss_db_exception.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/launchers/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/launchers/launcher_air.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/launchers/launcher_pro.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/pipelines/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/pipelines/pipeline_console.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/pipelines/pipeline_loghub.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/setting.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/utils/__init__.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/utils/oss.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb/utils/tools.py +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb_launcher.egg-info/SOURCES.txt +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb_launcher.egg-info/dependency_links.txt +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb_launcher.egg-info/requires.txt +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb_launcher.egg-info/top_level.txt +0 -0
- {cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/setup.cfg +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import time
|
|
2
|
+
import threading
|
|
3
|
+
|
|
4
|
+
from abc import ABC, abstractmethod
|
|
5
|
+
from cobweb.base import BaseItem, Queue, logger
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Pipeline(threading.Thread, ABC):
|
|
9
|
+
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
stop: threading.Event,
|
|
13
|
+
pause: threading.Event,
|
|
14
|
+
upload: Queue, done: Queue,
|
|
15
|
+
upload_size: int,
|
|
16
|
+
wait_seconds: int
|
|
17
|
+
):
|
|
18
|
+
super().__init__()
|
|
19
|
+
self._stop = stop
|
|
20
|
+
self._pause = pause
|
|
21
|
+
self._upload = upload
|
|
22
|
+
self._done = done
|
|
23
|
+
|
|
24
|
+
self.upload_size = upload_size
|
|
25
|
+
self.wait_seconds = wait_seconds
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def build(self, item: BaseItem) -> dict:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def upload(self, table: str, data: list) -> bool:
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
def run(self):
|
|
36
|
+
while not self._stop.is_set():
|
|
37
|
+
if not self._upload.length:
|
|
38
|
+
time.sleep(self.wait_seconds)
|
|
39
|
+
continue
|
|
40
|
+
if self._upload.length < self.upload_size:
|
|
41
|
+
time.sleep(self.wait_seconds)
|
|
42
|
+
status = True
|
|
43
|
+
data_info, seeds = {}, []
|
|
44
|
+
try:
|
|
45
|
+
for _ in range(self.upload_size):
|
|
46
|
+
item = self._upload.pop()
|
|
47
|
+
if not item:
|
|
48
|
+
break
|
|
49
|
+
seeds.append(item.seed)
|
|
50
|
+
data = self.build(item)
|
|
51
|
+
data_info.setdefault(item.table, []).append(data)
|
|
52
|
+
for table, datas in data_info.items():
|
|
53
|
+
try:
|
|
54
|
+
self.upload(table, datas)
|
|
55
|
+
except Exception as e:
|
|
56
|
+
logger.info(e)
|
|
57
|
+
status = False
|
|
58
|
+
except Exception as e:
|
|
59
|
+
logger.info(e)
|
|
60
|
+
status = False
|
|
61
|
+
if not status:
|
|
62
|
+
for seed in seeds:
|
|
63
|
+
seed.params.seed_status = "deal model: fail"
|
|
64
|
+
self._done.push(seeds)
|
|
65
|
+
|
|
66
|
+
logger.info("upload pipeline close!")
|
|
67
|
+
|
|
68
|
+
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import time
|
|
2
|
-
import threading
|
|
3
|
-
|
|
4
|
-
from abc import ABC, abstractmethod
|
|
5
|
-
from cobweb.base import BaseItem, Queue, logger
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Pipeline(threading.Thread, ABC):
|
|
9
|
-
|
|
10
|
-
def __init__(
|
|
11
|
-
self,
|
|
12
|
-
stop: threading.Event,
|
|
13
|
-
pause: threading.Event,
|
|
14
|
-
upload: Queue, done: Queue,
|
|
15
|
-
upload_size: int,
|
|
16
|
-
wait_seconds: int
|
|
17
|
-
):
|
|
18
|
-
super().__init__()
|
|
19
|
-
self._stop = stop
|
|
20
|
-
self._pause = pause
|
|
21
|
-
self._upload = upload
|
|
22
|
-
self._done = done
|
|
23
|
-
|
|
24
|
-
self.upload_size = upload_size
|
|
25
|
-
self.wait_seconds = wait_seconds
|
|
26
|
-
|
|
27
|
-
@abstractmethod
|
|
28
|
-
def build(self, item: BaseItem) -> dict:
|
|
29
|
-
pass
|
|
30
|
-
|
|
31
|
-
@abstractmethod
|
|
32
|
-
def upload(self, table: str, data: list) -> bool:
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
def run(self):
|
|
36
|
-
while not self._stop.is_set():
|
|
37
|
-
status = self._upload.length < self.upload_size
|
|
38
|
-
if status:
|
|
39
|
-
time.sleep(self.wait_seconds)
|
|
40
|
-
data_info, seeds = {}, []
|
|
41
|
-
for _ in range(self.upload_size):
|
|
42
|
-
item = self._upload.pop()
|
|
43
|
-
if not item:
|
|
44
|
-
break
|
|
45
|
-
data = self.build(item)
|
|
46
|
-
seeds.append(item.seed)
|
|
47
|
-
data_info.setdefault(item.table, []).append(data)
|
|
48
|
-
for table, datas in data_info.items():
|
|
49
|
-
try:
|
|
50
|
-
self.upload(table, datas)
|
|
51
|
-
status = True
|
|
52
|
-
except Exception as e:
|
|
53
|
-
logger.info(e)
|
|
54
|
-
status = False
|
|
55
|
-
if status:
|
|
56
|
-
self._done.push(seeds)
|
|
57
|
-
|
|
58
|
-
logger.info("upload pipeline close!")
|
|
59
|
-
|
|
60
|
-
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cobweb-launcher-1.2.8 → cobweb-launcher-1.2.10}/cobweb_launcher.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|