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 07:29:11 UTC

svn commit: r1131783 - in /incubator/mesos/trunk/frameworks/deploy_jar: daemon_executor.py daemon_scheduler.py

Author: benh
Date: Sun Jun  5 05:29:11 2011
New Revision: 1131783

URL: http://svn.apache.org/viewvc?rev=1131783&view=rev
Log:
Minor bug fixes to python deploy_jar framework.

Modified:
    incubator/mesos/trunk/frameworks/deploy_jar/daemon_executor.py
    incubator/mesos/trunk/frameworks/deploy_jar/daemon_scheduler.py

Modified: incubator/mesos/trunk/frameworks/deploy_jar/daemon_executor.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/frameworks/deploy_jar/daemon_executor.py?rev=1131783&r1=1131782&r2=1131783&view=diff
==============================================================================
--- incubator/mesos/trunk/frameworks/deploy_jar/daemon_executor.py (original)
+++ incubator/mesos/trunk/frameworks/deploy_jar/daemon_executor.py Sun Jun  5 05:29:11 2011
@@ -19,7 +19,7 @@ class MyExecutor(nexus.Executor):
     print "task id is " + str(task.taskId) + ", task.args is " + task.arg
     self.args = task.arg.split("\t")
     print "running: " + "java -cp " + self.args[0] + " " + self.args[1] + " " + self.args[2]
-    print Popen("java -cp " + self.args[0] + " " + self.args[1] + " " + self.args[2], shell=True, stdout=PIPE).stdout.readline()
+    print Popen("/usr/lib/jvm/java-6-sun/bin/java -cp " + self.args[0] + " " + self.args[1] + " " + self.args[2], shell=True, stdout=PIPE).stdout.readline()
     update = nexus.TaskStatus(task.taskId, nexus.TASK_FINISHED, "")
     driver.sendStatusUpdate(update)
     

Modified: incubator/mesos/trunk/frameworks/deploy_jar/daemon_scheduler.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/frameworks/deploy_jar/daemon_scheduler.py?rev=1131783&r1=1131782&r2=1131783&view=diff
==============================================================================
--- incubator/mesos/trunk/frameworks/deploy_jar/daemon_scheduler.py (original)
+++ incubator/mesos/trunk/frameworks/deploy_jar/daemon_scheduler.py Sun Jun  5 05:29:11 2011
@@ -69,7 +69,7 @@ class MyScheduler(nexus.Scheduler):
     self.lock.acquire()
     tasks = []
     for offer in slave_offers:
-      if self.task_count < self.num_tasks and int(offer.params['mem']) >= 1073741824 and int(offer.params['cpus']) > 0:
+      if int(self.task_count) < int(self.num_tasks) and int(offer.params['mem']) >= 1073741824 and int(offer.params['cpus']) > 0:
         print "accept slot here"
         params = {"cpus": "1", "mem": "1073741824"}
         task_args = self.jar_url + "\t" + self.jar_class + "\t" + self.jar_args
@@ -77,6 +77,8 @@ class MyScheduler(nexus.Scheduler):
         td = nexus.TaskDescription(
             self.task_count, offer.slaveId, "task %d" % self.task_count, params, task_args)
         tasks.append(td)
+        print "incrementing self.task_count from " + str(self.task_count)
+        print "self.num_tasks is " + str(self.num_tasks)
         self.task_count += 1
       else:
         print "Rejecting slot because we've launched enough tasks"
@@ -151,20 +153,23 @@ def monitor(sched):
       continue
 
 if __name__ == "__main__":
-  parser = OptionParser(usage = "Usage: daemon_framework <mesos-master> <num tasks> <URL of jar> <class name> <arguments>")
+  #parser = OptionParser(usage = "Usage: daemon_framework <mesos-master> <num tasks> <URL of jar> <class name> <arguments>")
 
-  (options,args) = parser.parse_args()
-  if len(args) < 5:
-    print >> sys.stderr, "five parameters required. " + str(len(args))
-    print >> sys.stderr, "Use --help to show usage."
-    exit(2)
+  #(options,args) = parser.parse_args()
+  #if len(args) < 5:
+  #  print >> sys.stderr, "five parameters required. " + str(len(args))
+  #  print >> sys.stderr, "Use --help to show usage."
+  #  exit(2)
+  args = sys.argv[1:len(sys.argv)]
+  
+  print "sched = MyScheduler(" + args[1] + ", "+  args[2]+ ", "+ args[3]+ ", "+ " ".join(args[4:len(args)])+")"
 
-  sched = MyScheduler(args[1], args[2], args[3], args[4])
+  sched = MyScheduler(args[1], args[2], args[3], " ".join(args[4:len(args)]))
 
   #threading.Thread(target = monitor, args=[sched]).start()
 
   print "Connecting to nexus master %s" % args[0]
 
-  nexus.NexusSchedulerDriver(sched, args[0]).run()
+  nexus.NexusSchedulerDriver(sched, sys.argv[1]).run()
 
   print "Finished!"