merge from trunk.
util.py: yuck, they changed the calling type for embedded ipython. also ensure we exit after leaving debug shell
git-svn-id: https://svn.apache.org/repos/asf/incubator/tashi/branches/stroucki-stable@1298112 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/INSTALL b/INSTALL
index 6240c35..17f4fc1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -124,6 +124,7 @@
given by the hostname command. If you plan on eventually having several
hosts and networks, feel free to add them now.
+root@grml:/usr/local/tashi# cd bin
root@grml:/usr/local/tashi/bin# DEBUG=1 ./clustermanager
2012-01-26 23:12:33,972 [./clustermanager:INFO] Using configuration file(s) ['/usr/local/tashi/etc/TashiDefaults.cfg']
2012-01-26 23:12:33,972 [./clustermanager:INFO] Starting cluster manager
@@ -158,9 +159,8 @@
In [4]: data.baseDataObject.save()
-In [5]: import os
-
-In [6]: os.kill(os.getpid(), 9)
+In [5]: (^C)
+2012-03-07 20:00:00,456 [./bin/clustermanager:INFO] Exiting cluster manager after receiving a SIGINT signal
Run the cluster manager in the background:
root@grml:/usr/local/tashi/bin# ./clustermanager &
diff --git a/src/tashi/client/tashi-client.py b/src/tashi/client/tashi-client.py
index a933a0c..261982b 100755
--- a/src/tashi/client/tashi-client.py
+++ b/src/tashi/client/tashi-client.py
@@ -340,7 +340,8 @@
print "Unknown function %s" % (func)
print
functions = argLists
- print "%s is the client program for Tashi, a system for cloud-computing on BigData." % (os.path.basename(sys.argv[0]))
+ print "%s is the client program for Tashi" % (os.path.basename(sys.argv[0]))
+ print "Tashi, a system for cloud-computing on BigData"
print "Visit http://incubator.apache.org/tashi/ for more information."
print
else:
diff --git a/src/tashi/clustermanager/data/getentoverride.py b/src/tashi/clustermanager/data/getentoverride.py
index d2f68d5..75703ea 100644
--- a/src/tashi/clustermanager/data/getentoverride.py
+++ b/src/tashi/clustermanager/data/getentoverride.py
@@ -19,7 +19,7 @@
import subprocess
import time
import os
-from tashi.rpycservices.rpyctypes import User, LocalImages
+from tashi.rpycservices.rpyctypes import User, LocalImages, Instance, Host
from tashi.clustermanager.data import DataInterface
from tashi.util import instantiateImplementation, humanReadable
@@ -66,7 +66,7 @@
return self.baseDataObject.acquireHost(hostId)
def releaseHost(self, host):
- if type(host) is not Instance:
+ if type(host) is not Host:
self.log.exception("Argument is not of type Host, but of type %s" % (type(host)))
raise TypeError
diff --git a/src/tashi/nodemanager/nodemanagerservice.py b/src/tashi/nodemanager/nodemanagerservice.py
index 569f189..eb22cd5 100755
--- a/src/tashi/nodemanager/nodemanagerservice.py
+++ b/src/tashi/nodemanager/nodemanagerservice.py
@@ -76,6 +76,8 @@
self.__registerHost()
+ # XXXstroucki: should make an effort to retry
+ # otherwise vmm will wait forever
self.id = self.cm.registerNodeManager(self.host, self.instances.values())
# XXXstroucki cut cross check for NM/VMM state
diff --git a/src/tashi/util.py b/src/tashi/util.py
index dd8a28d..1d114d5 100644
--- a/src/tashi/util.py
+++ b/src/tashi/util.py
@@ -211,28 +211,32 @@
raise Exception("No config file could be found: %s" % (str(allLocations)))
return (config, configFiles)
-def __getShellFn(globalDict):
- if sys.version_info < (2, 6, 1):
+def __getShellFn():
+ try:
from IPython.Shell import IPShellEmbed
- return IPShellEmbed(user_ns=globalDict)
- else:
+ return (1, IPShellEmbed)
+ except ImportError:
import IPython
- return IPython.embed(user_ns=globalDict)
+ return (2, IPython.embed)
def debugConsole(globalDict):
"""A debugging console that optionally uses pysh"""
def realDebugConsole(globalDict):
try :
import atexit
- shellfn = __getShellFn(globalDict)
+ (calltype, shellfn) = __getShellFn()
def resetConsole():
# XXXpipe: make input window sane
(stdin, stdout) = os.popen2("reset")
stdout.read()
- dbgshell = shellfn()
atexit.register(resetConsole)
- dbgshell()
- except Exception:
+ if calltype == 1:
+ dbgshell=shellfn(user_ns=globalDict)
+ dbgshell()
+ elif calltype == 2:
+ dbgshell=shellfn
+ dbgshell(user_ns=globalDict)
+ except Exception, e:
CONSOLE_TEXT=">>> "
input = " "
while (input != ""):
@@ -242,6 +246,10 @@
exec(input) in globalDict
except Exception, e:
sys.stdout.write(str(e) + "\n")
+
+ import os
+ os._exit(0)
+
if (os.getenv("DEBUG", "0") == "1"):
threading.Thread(target=lambda: realDebugConsole(globalDict)).start()