[rhmessaging-commits] rhmessaging commits: r4164 - mgmt/newdata/cumin/python/cumin/grid.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Jul 28 17:58:58 EDT 2010


Author: eallen
Date: 2010-07-28 17:58:57 -0400 (Wed, 28 Jul 2010)
New Revision: 4164

Modified:
   mgmt/newdata/cumin/python/cumin/grid/submission.py
Log:
Changes to accommodate different types of jobs submits

Modified: mgmt/newdata/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/submission.py	2010-07-28 21:55:44 UTC (rev 4163)
+++ mgmt/newdata/cumin/python/cumin/grid/submission.py	2010-07-28 21:58:57 UTC (rev 4164)
@@ -97,8 +97,11 @@
     def __init__(self, app, frame):
         super(SubmissionAdd, self).__init__(app, frame)
 
-        self.form = SubmissionAddForm(app, self.name, self)
+        self.form = self.get_add_form(app)
 
+    def get_add_form(self, app):
+        return SubmissionAddForm(app, self.name, self)
+
     def get_title(self, session):
         return "Create submission"
 
@@ -160,11 +163,11 @@
         self.description.help = "This text will identify the submission"
         self.add_field(self.description)
 
-        self.command = self.CommandField(app, "command")
-        self.command.input.columns = 50
-        self.command.required = True
-        self.command.help = "The path to the executable and any arguments"
-        self.add_field(self.command)
+        self.directory = self.WorkingDirectoryField(app, "directory")
+        self.directory.input.size = 50
+        self.directory.required = True
+        self.directory.help = "Run the process in this directory"
+        self.add_field(self.directory)
 
         self.requirements = self.RequirementsField(app, "requirements")
         self.requirements.input.columns = 50
@@ -173,12 +176,15 @@
             "this submission will run"
         self.add_field(self.requirements)
 
-        self.directory = self.WorkingDirectoryField(app, "directory")
-        self.directory.input.size = 50
-        self.directory.required = True
-        self.directory.help = "Run the process in this directory"
-        self.add_field(self.directory)
+        self.add_fields(app)
 
+    def add_fields(self, app):
+        self.command = self.CommandField(app, "command")
+        self.command.input.columns = 50
+        self.command.required = True
+        self.command.help = "The path to the executable and any arguments"
+        self.add_field(self.command)
+
         self.universe = self.UniverseField(app, "universe")
         self.add_extra_field(self.universe)
 
@@ -237,7 +243,7 @@
                              stdout=stdout,
                              stderr=stderr,
                              attrs=attrs)
-            
+
             self.task.exit_with_redirect(session)
 
     def parse_attributes(self, session):
@@ -394,3 +400,63 @@
     class AttributesField(MultilineStringField):
         def render_title(self, session):
             return "Extra attributes"
+
+class SubmissionVMAdd(SubmissionAdd):
+    def __init__(self, app, frame):
+        super(SubmissionVMAdd, self).__init__(app, frame)
+
+    def get_add_form(self, app):
+        return SubmissionAddVMForm(app, self.name, self)
+
+    def get_title(self, session):
+        return "Create VM submission"
+
+class SubmissionAddVMForm(SubmissionAddForm):
+    def add_fields(self, app):
+        self.disk = self.DiskField(app, "disk")
+        self.disk.input.size = 50
+        self.disk.required = True
+        self.disk.help = "VM disk img file location"
+        self.add_field(self.disk)
+
+        self.universe = Attribute(app, "universe")
+        self.universe.default = "vm"
+        self.add_attribute(self.universe)
+
+        self.attributes_ = self.VMAttributes(app, "attributes")
+        self.add_attribute(self.attributes_)
+
+        self.command = self.Command(app, "command")
+        self.command.default = ""
+        self.add_attribute(self.command)
+
+        self.stdin = Attribute(app, "stdin")
+        self.add_attribute(self.stdin)
+
+        self.stdout = Attribute(app, "stdout")
+        self.add_attribute(self.stdout)
+
+        self.stderr = Attribute(app, "stderr")
+        self.add_attribute(self.stderr)
+
+    class DiskField(StringField):
+        def render_title(self, session):
+            return "Disk"
+
+    class Command(Attribute):
+        def get(self, session):
+            return self.widget.disk.get(session)
+
+    class VMAttributes(Attribute):
+        def get(self, session):
+            vm_ads = list()
+            vm_ads.append("vm_type=kvm")
+            vm_ads.append("vm_networking=false")
+            vm_ads.append("vm_memory=128")
+            vm_ads.append("xen_kernal=included")
+
+            disk = self.widget.disk.get(session)
+            vm_ads.append("xan_disk=%s:hda:w" % disk)
+            vm_ads.append("executable=%s" % disk)
+
+            return "\n".join(vm_ads)



More information about the rhmessaging-commits mailing list