Further reduce os.walk() in launcher.py to speed up

pull/319/head
Federico Leva 6 years ago
parent b7789751fc
commit 6fbde766c4

@ -69,12 +69,11 @@ def main():
#download #download
started = False #was this wiki download started before? then resume started = False #was this wiki download started before? then resume
wikidir = '' wikidir = ''
for dirname, dirnames, filenames in os.walk('.'): for f in os.listdir('.'):
if dirname == '.': # Does not find numbered wikidumps not verify directories
for d in dirnames: if d.startswith(prefix) and d.endswith('wikidump'):
if d.startswith(prefix): wikidir = d
wikidir = d started = True
started = True
break #stop searching, dot not explore subdirectories break #stop searching, dot not explore subdirectories
# time.sleep(60) # time.sleep(60)
@ -88,11 +87,10 @@ def main():
subprocess.call('./dumpgenerator.py --api=%s --xml --images' % wiki, shell=True) subprocess.call('./dumpgenerator.py --api=%s --xml --images' % wiki, shell=True)
started = True started = True
#save wikidir now #save wikidir now
for dirname, dirnames, filenames in os.walk('.'): for f in os.listdir('.'):
if dirname == '.': # Does not find numbered wikidumps not verify directories
for d in dirnames: if d.startswith(prefix) and d.endswith('wikidump'):
if d.startswith(prefix): wikidir = d
wikidir = d
break #stop searching, dot not explore subdirectories break #stop searching, dot not explore subdirectories
prefix = wikidir.split('-wikidump')[0] prefix = wikidir.split('-wikidump')[0]

Loading…
Cancel
Save