Created
September 18, 2014 12:24
-
-
Save vtajzich/70d705f7ca93a2b360b1 to your computer and use it in GitHub Desktop.
Run mulptiple ES import scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File base = new File('<INSERT BASE DIR HERE>') | |
File data = new File(base, 'data') | |
File scripts = new File(base, 'scripts') | |
def isDone = { String name -> | |
return data.list().find { it == "${name}.csv.processing.imported"} != null | |
} | |
scripts.listFiles().each { | |
String name = it.name.find(/[A-Z]+/) | |
if(isDone(name)) { | |
println "Skipping: $name" | |
} else { | |
long start = System.currentTimeMillis() | |
println "Running $name" | |
it.absolutePath.execute() | |
while(!isDone(name)) { | |
Thread.sleep(500) | |
} | |
long end = System.currentTimeMillis() | |
println "Done, took: ${(end - start) / 1000}s" | |
} | |
} | |
println "All done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment