mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 09:47:17 +00:00
Fixed all_index newline bug + added print of what's happening
This commit is contained in:
parent
5b7d047622
commit
3261eca836
2 changed files with 6 additions and 3 deletions
|
@ -66,8 +66,11 @@ if __name__ == "__main__":
|
||||||
# create the index register if not present
|
# create the index register if not present
|
||||||
time_now = int(time.time())
|
time_now = int(time.time())
|
||||||
if not os.path.isfile(indexRegister_path): #index are not organised
|
if not os.path.isfile(indexRegister_path): #index are not organised
|
||||||
|
print("Indexes are not organized")
|
||||||
|
print("moving all files in folder 'old_index' ")
|
||||||
#move all files to old_index folder
|
#move all files to old_index folder
|
||||||
move_index_into_old_index_folder(baseindexpath)
|
move_index_into_old_index_folder(baseindexpath)
|
||||||
|
print("Creating new index")
|
||||||
#create all_index.txt
|
#create all_index.txt
|
||||||
with open(indexRegister_path, 'w') as f:
|
with open(indexRegister_path, 'w') as f:
|
||||||
f.write(str(time_now))
|
f.write(str(time_now))
|
||||||
|
@ -76,7 +79,7 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
with open(indexRegister_path, "r") as f:
|
with open(indexRegister_path, "r") as f:
|
||||||
allIndex = f.read()
|
allIndex = f.read()
|
||||||
allIndex = allIndex.split(',') # format [time1,time2]
|
allIndex = allIndex.split() # format [time1\ntime2]
|
||||||
allIndex.sort()
|
allIndex.sort()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -119,7 +122,7 @@ if __name__ == "__main__":
|
||||||
indexname = str(timestamp)
|
indexname = str(timestamp)
|
||||||
#update all_index
|
#update all_index
|
||||||
with open(indexRegister_path, "a") as f:
|
with open(indexRegister_path, "a") as f:
|
||||||
f.write(","+str(timestamp))
|
f.write(str(timestamp))
|
||||||
#create new dir
|
#create new dir
|
||||||
os.mkdir(indexpath)
|
os.mkdir(indexpath)
|
||||||
ix = create_in(indexpath, schema)
|
ix = create_in(indexpath, schema)
|
||||||
|
|
|
@ -34,7 +34,7 @@ indexRegister_path = os.path.join(os.environ['AIL_HOME'],
|
||||||
def get_current_index():
|
def get_current_index():
|
||||||
with open(indexRegister_path, "r") as f:
|
with open(indexRegister_path, "r") as f:
|
||||||
allIndex = f.read()
|
allIndex = f.read()
|
||||||
allIndex = allIndex.split(',') # format [time1,time2]
|
allIndex = allIndex.split() # format [time1\ntime2]
|
||||||
allIndex.sort()
|
allIndex.sort()
|
||||||
try:
|
try:
|
||||||
indexname = allIndex[-1].strip('\n\r')
|
indexname = allIndex[-1].strip('\n\r')
|
||||||
|
|
Loading…
Reference in a new issue