File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,4 @@ migrations
9
9
alembic.ini
10
10
alembic
11
11
env /
12
- local_checkers /
12
+ local /
Original file line number Diff line number Diff line change
1
+ from models import session , CollectorState
2
+ from proxy_py import settings
3
+
1
4
import os
2
5
import importlib .util
3
6
4
- from models import session , CollectorState
5
-
6
7
7
8
collectors = {}
8
9
9
10
10
- for root , dirs , files in os .walk ("collectors" ):
11
+ for root , dirs , files in os .walk (settings . COLLECTORS_DIR ):
11
12
for file in files :
12
13
if file .endswith (".py" ):
13
14
file_path = os .path .join (root , file )
43
44
# return collectorState
44
45
45
46
46
- def get_collector_of_module_name (module_name : str ):
47
+ def get_collector_of_module_name (module_name : str ):
47
48
if module_name not in collectors :
48
49
raise CollectorNotFoundException ()
49
50
50
51
return collectors [module_name ]
51
52
52
53
53
- async def load_collector (state : CollectorState ):
54
+ async def load_collector (state : CollectorState ):
54
55
collector = get_collector_of_module_name (state .identifier )
55
56
await collector .load_state (state )
56
57
return collector
57
58
58
59
59
60
class CollectorNotFoundException (BaseException ):
60
- pass
61
+ pass
Original file line number Diff line number Diff line change 13
13
14
14
DEBUG = True
15
15
16
+ COLLECTORS_DIR = 'collectors'
17
+
16
18
# fetcher settings
17
19
18
20
CONCURRENT_TASKS_COUNT = 128
You can’t perform that action at this time.
0 commit comments