You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/05 06:54:39 UTC

svn commit: r1131661 - in /incubator/mesos/trunk/frameworks/torque: start_pbs_mom.py torquesched.py

Author: benh
Date: Sun Jun  5 04:54:38 2011
New Revision: 1131661

URL: http://svn.apache.org/viewvc?rev=1131661&view=rev
Log:
Make torque executor work with new executor API, scheduler closer to scaling down

Modified:
    incubator/mesos/trunk/frameworks/torque/start_pbs_mom.py
    incubator/mesos/trunk/frameworks/torque/torquesched.py

Modified: incubator/mesos/trunk/frameworks/torque/start_pbs_mom.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/frameworks/torque/start_pbs_mom.py?rev=1131661&r1=1131660&r2=1131661&view=diff
==============================================================================
--- incubator/mesos/trunk/frameworks/torque/start_pbs_mom.py (original)
+++ incubator/mesos/trunk/frameworks/torque/start_pbs_mom.py Sun Jun  5 04:54:38 2011
@@ -22,11 +22,12 @@ class MyExecutor(nexus.Executor):
   def __init__(self):
     nexus.Executor.__init__(self)
 
-  def init(self, arg):
+  def init(self, driver, arg):
     print "in torque executor init"
+    print "initializing self.pbs_server_ip to " + str(arg.data)
     self.pbs_server_ip = arg.data
 
-  def startTask(self, task):
+  def launchTask(self, driver, task):
     print "Running task %d" % task.taskId
     
     print "checking pbs_mom conf file " + PBS_MOM_CONF_FILE + " is it a file? "\
@@ -36,10 +37,10 @@ class MyExecutor(nexus.Executor):
     if not os.path.isfile(PBS_MOM_CONF_FILE):
       print PBS_MOM_CONF_FILE + " file not found, about to create it"
     else:
-      print "about to overwrite file " + PBS_MOM_CONF_FILE + " to update "\
-            "pbs_server on this node"
+      print "about to overwrite file " + PBS_MOM_CONF_FILE + " to update "#\
+#            + "pbs_server on this node"
 
-    print "adding line to conf file: $pbsserver " + self.pbs_server_ip + "\n"
+    print "adding line to conf file: $pbsserver " #+ self.pbs_server_ip + "\n"
     FILE = open(PBS_MOM_CONF_FILE,'w')
     FILE.write("$pbsserver " + self.pbs_server_ip + "\n")
     FILE.write("$logevent 255 #bitmap of which events to log\n")
@@ -59,18 +60,18 @@ class MyExecutor(nexus.Executor):
     print "running pbs_mom on compute node"
     Popen("pbs_mom", shell=True)
 
-  def killTask(self, tid):
+  def killTask(self, driver, tid):
     sys.exit(1)
 
-  def shutdown(self):
+  def shutdown(self, driver):
     print "shutdown"
     cleanup()
 
-  def error(self, code, message):
+  def error(self, driver, code, message):
     print "Error: %s" % message
 
 if __name__ == "__main__":
   print "Starting pbs_mom executor"
   atexit.register(cleanup)
   executor = MyExecutor()
-  executor.run()
+  nexus.NexusExecutorDriver(executor).run()

Modified: incubator/mesos/trunk/frameworks/torque/torquesched.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/frameworks/torque/torquesched.py?rev=1131661&r1=1131660&r2=1131661&view=diff
==============================================================================
--- incubator/mesos/trunk/frameworks/torque/torquesched.py (original)
+++ incubator/mesos/trunk/frameworks/torque/torquesched.py Sun Jun  5 04:54:38 2011
@@ -27,7 +27,7 @@ class MyScheduler(nexus.Scheduler):
   
   def getExecutorInfo(self, driver):
     execPath = os.path.join(os.getcwd(), "start_pbs_mom.sh")
-    initArg = ip # tell executor which node the pbs_server is running on
+    initArg = self.ip # tell executor which node the pbs_server is running on
     print "in getExecutorInfo, setting execPath = " + execPath + " and initArg = " + initArg
     return nexus.ExecutorInfo(execPath, initArg)
 
@@ -87,7 +87,7 @@ class MyScheduler(nexus.Scheduler):
   def unregAllNodes(self):
     for node in self.servers.values():
       print "unregistering node " + str(node)
-      unregComputeNode(node)
+      self.unregComputeNode(node)
       self.servers.pop(node)
   
   def getFrameworkName(self, driver):
@@ -111,10 +111,13 @@ def monitor(sched):
       print "no incomplete jobs in queue, attempting to release all slots"
       if len(sched.servers) == 0:
         print "no servers registered, so no need to call unregAllNodes()"
+        print "monitor thread releasing lock"
+        sched.lock.release()
         continue
       sched.unregAllNodes()
     print ""
     sched.lock.release()
+    print "monitor thread releasing lock"
 
 if __name__ == "__main__":
   parser = OptionParser(usage = "Usage: %prog nexus_master")
@@ -129,13 +132,16 @@ if __name__ == "__main__":
   Popen("qterm", shell=True).wait()
 
   print "starting pbs_server"
-  Popen("/etc/init.d/pbs_server start", shell=True)
+  #Popen("/etc/init.d/pbs_server start", shell=True)
+  Popen("pbs_server", shell=True)
 
   print "starting pbs_scheduler"
-  Popen("/etc/init.d/pbs_sched start", shell=True)
+  #Popen("/etc/init.d/pbs_sched start", shell=True)
+  Popen("pbs_sched", shell=True)
 
-  ip = Popen("hostname -i", shell=True, stdout=PIPE).stdout.readline().rstrip()
-  print "Remembering IP address of scheduler (" + ip + ")"
+  #ip = Popen("hostname -i", shell=True, stdout=PIPE).stdout.readline().rstrip() #linux
+  ip = Popen("ifconfig en1 | awk '/inet / { print $2 }'", shell=True, stdout=PIPE).stdout.readline().rstrip() # os x
+  print "Remembering IP address of scheduler (" + ip + "), type: " + str(type(ip))
 
   print "Connecting to nexus master %s" % args[0]