Implement indexing into Apache Druid #1

Closed
m wants to merge 263 commits from druid into master
1 changed files with 5 additions and 1 deletions
Showing only changes of commit f54a448d54 - Show all commits

View File

@ -6,7 +6,7 @@ import commands
from main import CommandMap from main import CommandMap
def loadCommands(): def loadCommands(allowDup=False):
for filename in listdir("commands"): for filename in listdir("commands"):
if filename.endswith(".py") and filename != "__init__.py": if filename.endswith(".py") and filename != "__init__.py":
commandName = filename[0:-3] commandName = filename[0:-3]
@ -17,6 +17,10 @@ def loadCommands():
CommandMap[commandName] = getattr(getattr(module, commandName), className) CommandMap[commandName] = getattr(getattr(module, commandName), className)
debug("Registered command: %s" % commandName) debug("Registered command: %s" % commandName)
else: else:
if allowDup:
CommandMap[commandName] = getattr(getattr(module, commandName), className)
debug("Registered command: %s" % commandName)
error("Duplicate command: %s" % (commandName)) error("Duplicate command: %s" % (commandName))
except Exception as err: except Exception as err:
error("Exception while loading command %s:\n%s" % (commandName, err)) error("Exception while loading command %s:\n%s" % (commandName, err))