Implement indexing into Apache Druid #1
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue