-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (31 loc) · 914 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from db_models.mongo_setup import global_init
from db_models.models.cache_model import Cache
from db_models.models.web_model import Web
from index_urls import process_url_doc
import globals
import os
import time
from index_task import process_index_doc
from elasticsearch import Elasticsearch
from run_queue_worker import q
import os
client = Elasticsearch(globals.ELASTIC_SEARCH_HOST)
global_init()
# if not client.indices.exists(index="semantic"):
# print("creating_index")
# os.system("python3 create_index.py")
a=time.time()
for file in Cache.objects:
id = file.id
if file.text:
print(type(str(id)))
#process_index_doc((str(id)))
q.enqueue(process_index_doc, (str(id)))
for site in Web.objects:
id = site.id
if site.text:
print(type(str(id)))
#process_url_doc((str(id)))
q.enqueue(process_url_doc, (str(id)))
b=time.time()
print(b-a)