mirror of https://github.com/CIRCL/AIL-framework
Merge branch 'newIndexer' into auto-conf
commit
72c1d903eb
|
@ -15,13 +15,14 @@ from pubsublogger import publisher
|
||||||
|
|
||||||
from whoosh.index import create_in, exists_in, open_dir
|
from whoosh.index import create_in, exists_in, open_dir
|
||||||
from whoosh.fields import Schema, TEXT, ID
|
from whoosh.fields import Schema, TEXT, ID
|
||||||
|
import shutil
|
||||||
import os
|
import os
|
||||||
from os.path import join, getsize
|
from os.path import join, getsize
|
||||||
|
|
||||||
from Helper import Process
|
from Helper import Process
|
||||||
|
|
||||||
# Config variable
|
# Config variable
|
||||||
TIME_WAIT = 1.0 #sec
|
TIME_WAIT = 60*15 #sec
|
||||||
|
|
||||||
# return in bytes
|
# return in bytes
|
||||||
def check_index_size(baseindexpath, indexname):
|
def check_index_size(baseindexpath, indexname):
|
||||||
|
@ -32,11 +33,9 @@ def check_index_size(baseindexpath, indexname):
|
||||||
return cur_sum
|
return cur_sum
|
||||||
|
|
||||||
def move_index_into_old_index_folder(baseindexpath):
|
def move_index_into_old_index_folder(baseindexpath):
|
||||||
command_move = "mv {} {}"
|
for cur_file in os.listdir(baseindexpath):
|
||||||
os.mkdir(join(baseindexpath, "old_index"))
|
if not cur_file == "old_index":
|
||||||
for files in os.listdir(baseindexpath):
|
shutil.move(join(baseindexpath, cur_file), join(join(baseindexpath, "old_index"), cur_file))
|
||||||
if not files == "old_index":
|
|
||||||
os.system(command_move.format(join(baseindexpath, files), join(join(baseindexpath, "old_index"), files)))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue