Skip to content

Instantly share code, notes, and snippets.

@vtajzich
Created September 18, 2014 12:24
Show Gist options
  • Save vtajzich/70d705f7ca93a2b360b1 to your computer and use it in GitHub Desktop.
Save vtajzich/70d705f7ca93a2b360b1 to your computer and use it in GitHub Desktop.
Run mulptiple ES import scripts
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