incubator-tashi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Cipar <jci...@cs.cmu.edu>
Subject Re: Remove environment variables
Date Wed, 21 Jan 2009 23:16:40 GMT
Whoops, I had forgotten to restart the scheduler when testing this,  
when I did, I realized that I also forgot to add an import in the  
scheduler.  The correct patch for examplepolicy.py:

Index: trunk/src/tashi/agents/examplepolicy.py
===================================================================
--- trunk/src/tashi/agents/examplepolicy.py	(revision 735143)
+++ trunk/src/tashi/agents/examplepolicy.py	(working copy)
@@ -27,6 +27,8 @@
  from thrift.transport.TTransport import TBufferedTransport
  from tashi.services import clustermanagerservice

+from tashi.util import getConfig
+
  class ExamplePolicy():
  	def __init__(self, client, transport):
  		self.client = client
@@ -77,9 +79,11 @@
  				time.sleep(2)

  def createClient():
-	host = os.getenv('TASHI_CM_HOST', 'localhost')
-	port = os.getenv('TASHI_CM_PORT', '9882')
-	timeout = float(os.getenv('TASHI_CM_TIMEOUT', '5000.0'))
+        (config,configFiles) = getConfig(["Client"])
+        host = config.get('ClusterManagerService', 'host')
+        port = config.get('ClusterManagerService', 'port')
+        timeout = float(config.get('Client', 'timeout'))
+
  	socket = TSocket(host, int(port))
  	socket.setTimeout(timeout)
  	transport = TBufferedTransport(socket)



On Jan 15, 2009, at 3:40 PM, Jim Cipar wrote:

> I realized that attachments don't work.  Here is the patch:
>
> Index: trunk/src/tashi/agents/examplepolicy.py
> ===================================================================
> --- trunk/src/tashi/agents/examplepolicy.py	(revision 734779)
> +++ trunk/src/tashi/agents/examplepolicy.py	(working copy)
> @@ -77,9 +77,11 @@
> 				time.sleep(2)
>
> def createClient():
> -	host = os.getenv('TASHI_CM_HOST', 'localhost')
> -	port = os.getenv('TASHI_CM_PORT', '9882')
> -	timeout = float(os.getenv('TASHI_CM_TIMEOUT', '5000.0'))
> +        (config,configFiles) = getConfig(["Client"])
> +        host = config.get('ClusterManagerService', 'host')
> +        port = config.get('ClusterManagerService', 'port')
> +        timeout = float(config.get('Client', 'timeout'))
> +
> 	socket = TSocket(host, int(port))
> 	socket.setTimeout(timeout)
> 	transport = TBufferedTransport(socket)
> Index: trunk/src/tashi/client/client.py
> ===================================================================
> --- trunk/src/tashi/client/client.py	(revision 734779)
> +++ trunk/src/tashi/client/client.py	(working copy)
> @@ -28,6 +28,8 @@
> from tashi.services import clustermanagerservice
> from tashi import vmStates
>
> +from tashi.util import getConfig
> +
> def makeHTMLTable(list):
> 	(stdin_r, stdin_w) = os.pipe()
> 	pipe = os.popen("tput cols")
> @@ -146,9 +148,12 @@
> 		for m in methods:
> 			os.unlink(m)
> 		sys.exit(0)
> -	host = os.getenv('TASHI_CM_HOST', 'localhost')
> -	port = os.getenv('TASHI_CM_PORT', '9882')
> -	timeout = float(os.getenv('TASHI_CM_TIMEOUT', '5000.0'))
> +
> +        (config,configFiles) = getConfig(["Client"])
> +        host = config.get('ClusterManagerService', 'host')
> +        port = config.get('ClusterManagerService', 'port')
> +        timeout = float(config.get('Client', 'timeout'))
> +
> 	socket = TSocket(host, int(port))
> 	socket.setTimeout(timeout)
> 	transport = TBufferedTransport(socket)
> Index: trunk/etc/TashiDefaults.cfg
> ===================================================================
> --- trunk/etc/TashiDefaults.cfg	(revision 734779)
> +++ trunk/etc/TashiDefaults.cfg	(working copy)
> @@ -57,6 +57,10 @@
> clusterManagerPort = 9882
> ;bind = 0.0.0.0 ; not supported (Thrift is missing support to  
> specify what to bind to!)
>
> +# Client configuration
> +[Client]
> +timeout = 5000.0
> +
> [Qemu]
> qemuBin = /usr/local/bin/qemu-system-x86_64
> infoDir = /var/tmp/VmControlQemu/
>
>


Mime
View raw message