[cig-commits] r15100 - in cs/pythia/trunk: . pyre/inventory pyre/schedulers pyre/schedulers/scripts/lsf pyre/schedulers/scripts/pbs pyre/schedulers/scripts/sge pyre/schedulers/scripts/tacc-ranger

leif at geodynamics.org leif at geodynamics.org
Mon Jun 1 19:11:02 PDT 2009


Author: leif
Date: 2009-06-01 19:11:01 -0700 (Mon, 01 Jun 2009)
New Revision: 15100

Added:
   cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.odb
   cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.odb
   cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.odb
   cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.odb
Removed:
   cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.tmpl
   cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.tmpl
   cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.tmpl
   cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.tmpl
Modified:
   cs/pythia/trunk/pyre/inventory/Configurable.py
   cs/pythia/trunk/pyre/schedulers/BatchScriptTemplate.py
   cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py
   cs/pythia/trunk/pyre/schedulers/SchedulerPBS.py
   cs/pythia/trunk/pyre/schedulers/SchedulerSGE.py
   cs/pythia/trunk/setup.py
Log:
Broke dependency on Cheetah.


Modified: cs/pythia/trunk/pyre/inventory/Configurable.py
===================================================================
--- cs/pythia/trunk/pyre/inventory/Configurable.py	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/inventory/Configurable.py	2009-06-02 02:11:01 UTC (rev 15100)
@@ -153,7 +153,7 @@
 
 
     def retrieveTemplate(self, name, vault=[], extras=[]):
-        return self.retrieveObject(name, 'template', ['tmpl'], vault, extras)
+        return self.retrieveComponent(name, 'template', vault=vault, extras=extras)
 
 
     # vault accessors

Modified: cs/pythia/trunk/pyre/schedulers/BatchScriptTemplate.py
===================================================================
--- cs/pythia/trunk/pyre/schedulers/BatchScriptTemplate.py	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/BatchScriptTemplate.py	2009-06-02 02:11:01 UTC (rev 15100)
@@ -11,36 +11,27 @@
 #
 
 
-from Cheetah.Template import Template
+from pyre.components import Component
 
 
-class BatchScriptTemplate(Template):
+class BatchScriptTemplate(Component):
 
 
-    """base class for Cheetah batch script templates"""
+    """base class for batch script templates"""
 
-    
-    def getStdin(self):        return self.getRemoteFilename('stdin')
-    def getStdout(self):       return self.getRemoteFilename('stdout')
-    def getStderr(self):       return self.getRemoteFilename('stderr')
 
+    def __init__(self, name):
+        Component.__init__(self, name, facility='template')
+        self.scheduler = None
+        self.script = None
 
-    def getRemoteFilename(self, name):
-        # stub
-        filename = self.job.getTraitValue(name)
-        return filename
 
+    def render(self):
+        raise NotImplementedError("class %r must override 'render'" % self.__class__.__name__)
 
-    def getStagedFiles(self):
-        # stub
-        return []
 
-    
-    stdin        = property(getStdin)
-    stdout       = property(getStdout)
-    stderr       = property(getStderr)
+    def __str__(self):
+        return self.render()
 
-    stagedFiles  = property(getStagedFiles)
 
-
 # end of file 

Modified: cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py
===================================================================
--- cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py	2009-06-02 02:11:01 UTC (rev 15100)
@@ -41,6 +41,10 @@
         
         # Generate the main LSF batch script.
         script = self.retrieveTemplate('batch.sh', ['schedulers', 'scripts', self.name])
+        if script is None:
+            self._error.log("could not locate batch script template for '%s'" % self.name)
+            sys.exit(1)
+        
         script.scheduler = self
         script.job = job
         
@@ -49,7 +53,6 @@
             return
 
         try:
-            import os
             from popen2 import Popen4
 
             cmd = [self.command]

Modified: cs/pythia/trunk/pyre/schedulers/SchedulerPBS.py
===================================================================
--- cs/pythia/trunk/pyre/schedulers/SchedulerPBS.py	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/SchedulerPBS.py	2009-06-02 02:11:01 UTC (rev 15100)
@@ -40,6 +40,10 @@
         
         # Generate the main PBS batch script.
         script = self.retrieveTemplate('batch.sh', ['schedulers', 'scripts', self.name])
+        if script is None:
+            self._error.log("could not locate batch script template for '%s'" % self.name)
+            sys.exit(1)
+        
         script.scheduler = self
         script.job = job
         

Modified: cs/pythia/trunk/pyre/schedulers/SchedulerSGE.py
===================================================================
--- cs/pythia/trunk/pyre/schedulers/SchedulerSGE.py	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/SchedulerSGE.py	2009-06-02 02:11:01 UTC (rev 15100)
@@ -40,6 +40,10 @@
         
         # Generate the main SGE batch script.
         script = self.retrieveTemplate('batch.sh', ['schedulers', 'scripts', self.name])
+        if script is None:
+            self._error.log("could not locate batch script template for '%s'" % self.name)
+            sys.exit(1)
+        
         script.scheduler = self
         script.job = job
         

Added: cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.odb
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.odb	                        (rev 0)
+++ cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.odb	2009-06-02 02:11:01 UTC (rev 15100)
@@ -0,0 +1,46 @@
+# -*- Python -*-
+
+def template():
+    from pyre.schedulers import BatchScriptTemplate
+
+    class LSFBatchScriptTemplate(BatchScriptTemplate):
+
+        def __init__(self):
+            BatchScriptTemplate.__init__(self, "lsf")
+        
+        def render(self):
+            from StringIO import StringIO
+
+            out = StringIO()
+            scheduler = self.scheduler
+            job = self.job
+            
+            print >>out, "#!%s" % scheduler.shell
+            print >>out, "#BSUB -J", job.task
+            if job.queue:
+                print >>out, "#BSUB -q", job.queue
+            if max(job.walltime):
+                print >>out, "#BSUB -W", "%d:%02d" % job.walltime[0:2]
+            print >>out, "#BSUB -n", job.nodes
+            if job.stdin:
+                print >>out, "#BSUB -i", job.stdin
+            if job.stdout:
+                print >>out, "#BSUB -o", job.stdout
+            if job.stderr:
+                print >>out, "#BSUB -e", job.stderr
+            for option in scheduler.bsubOptions:
+                print >>out, "#BSUB", option
+            print >>out
+            print >>out, job.executable, ' '.join(job.arguments)
+            print >>out
+            if job.comments:
+                print >>out, "# ~~~~ comments ~~~~"
+                for line in job.comments:
+                    print >>out, "#", line
+            print >>out
+            print >>out, "# ~~~~ submit command ~~~~"
+            print >>out, "# %s < [script]" % scheduler.command
+            
+            return out.getvalue()
+    
+    return LSFBatchScriptTemplate()

Deleted: cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.tmpl
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.tmpl	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/scripts/lsf/batch.sh.tmpl	2009-06-02 02:11:01 UTC (rev 15100)
@@ -1,52 +0,0 @@
-## -*- sh -*-
-#compiler-settings
-directiveStartToken = @
-#end compiler-settings
- at from pyre.schedulers import BatchScriptTemplate
- at extends BatchScriptTemplate
- at implements respond
- at set $self.substitutions = {'job.id': "%J"}
-#!${scheduler.shell}
-#BSUB -J ${job.task}
- at if $job.queue
-#BSUB -q ${job.queue}
- at end if
- at if max($job.walltime)
-#BSUB -W @echo ("%d:%02d" % $job.walltime[0:2])
- at end if
-#BSUB -n ${job.nodes}
- at if $self.stdin
-#BSUB -i ${self.stdin}
- at end if
- at if $self.stdout
-#BSUB -o ${self.stdout}
- at end if
- at if $self.stderr
-#BSUB -e ${self.stderr}
- at end if
- at for direction, localPathname, remoteFilename in $self.stagedFiles
- at if $direction == "in"
-#BSUB -f "${localPathname} > ${remoteFilename}"
- at else if $direction == "out"
-#BSUB -f "${localPathname} < ${remoteFilename}"
- at else
- at raise RuntimeError("LSF doesn't understand the stage direction '%s'" % $direction)
- at end if
- at end for
- at for option in $scheduler.bsubOptions
-#BSUB ${option}
- at end for
-
- at set $self.substitutions = {'job.id': "${LSB_JOBID}"}
-
-${job.executable} @echo ' '.join($job.arguments)
-
- at if $job.comments
-# ~~~~ comments ~~~~
- at for line in $job.comments
-# ${line}
- at end for
- at end if
-
-# ~~~~ submit command ~~~~
-# ${scheduler.command} < [script]

Added: cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.odb
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.odb	                        (rev 0)
+++ cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.odb	2009-06-02 02:11:01 UTC (rev 15100)
@@ -0,0 +1,45 @@
+# -*- Python -*-
+
+def template():
+    from pyre.schedulers import BatchScriptTemplate
+
+    class PBSBatchScriptTemplate(BatchScriptTemplate):
+
+        def __init__(self):
+            BatchScriptTemplate.__init__(self, "pbs")
+        
+        def render(self):
+            from StringIO import StringIO
+
+            out = StringIO()
+            scheduler = self.scheduler
+            job = self.job
+            
+            print >>out, "#!%s" % scheduler.shell
+            print >>out, "#PBS -S", scheduler.shell
+            print >>out, "#PBS -N", job.task
+            if job.queue:
+                print >>out, "#PBS -q", job.queue
+            if job.stdout:
+                print >>out, "#PBS -o", job.stdout
+            if job.stderr:
+                print >>out, "#PBS -e", job.stderr
+            if job.resourceList:
+                print >>out, "#PBS -l", ','.join(job.resourceList)
+            for option in scheduler.qsubOptions:
+                print >>out, "#PBS", option
+            print >>out
+            print >>out, "cd $PBS_O_WORKDIR"
+            print >>out, job.executable, ' '.join(job.arguments)
+            print >>out
+            if job.comments:
+                print >>out, "# ~~~~ comments ~~~~"
+                for line in job.comments:
+                    print >>out, "#", line
+            print >>out
+            print >>out, "# ~~~~ submit command ~~~~"
+            print >>out, "# %s < [script]" % scheduler.command
+            
+            return out.getvalue()
+    
+    return PBSBatchScriptTemplate()

Deleted: cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.tmpl
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.tmpl	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/scripts/pbs/batch.sh.tmpl	2009-06-02 02:11:01 UTC (rev 15100)
@@ -1,39 +0,0 @@
-## -*- sh -*-
-#compiler-settings
-directiveStartToken = @
-#end compiler-settings
- at from pyre.schedulers import BatchScriptTemplate
- at extends BatchScriptTemplate
- at implements respond
- at set $self.substitutions = {'job.id': "${PBS_JOBID}"}
-#!${scheduler.shell}
-#PBS -S ${scheduler.shell}
-#PBS -N ${job.task}
- at if $job.queue
-#PBS -q ${job.queue}
- at end if
- at if $self.stdout
-#PBS -o ${self.stdout}
- at end if
- at if $self.stderr
-#PBS -e ${self.stderr}
- at end if
- at if $job.resourceList
-#PBS -l @echo ','.join($job.resourceList)
- at end if
- at for option in $scheduler.qsubOptions
-#PBS ${option}
- at end for
-
-cd \$PBS_O_WORKDIR
-${job.executable} @echo ' '.join($job.arguments)
-
- at if $job.comments
-# ~~~~ comments ~~~~
- at for line in $job.comments
-# ${line}
- at end for
- at end if
-
-# ~~~~ submit command ~~~~
-# ${scheduler.command} < [script]

Added: cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.odb
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.odb	                        (rev 0)
+++ cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.odb	2009-06-02 02:11:01 UTC (rev 15100)
@@ -0,0 +1,46 @@
+# -*- Python -*-
+
+def template():
+    from pyre.schedulers import BatchScriptTemplate
+
+    class SGEBatchScriptTemplate(BatchScriptTemplate):
+
+        def __init__(self):
+            BatchScriptTemplate.__init__(self, "sge")
+        
+        def render(self):
+            from StringIO import StringIO
+
+            out = StringIO()
+            scheduler = self.scheduler
+            job = self.job
+            
+            print >>out, "#!%s" % scheduler.shell
+            print >>out, "#$ -S", scheduler.shell
+            print >>out, "#$ -cwd"
+            print >>out, "#$ -N", job.task
+            if job.queue:
+                print >>out, "#$ -q", job.queue
+            if max(job.walltime):
+                print >>out, "#$ -l h_rt=%d:%02d:%02d" % job.walltime[0:3]
+            print >>out, "#$ -pe", scheduler.peName, eval(scheduler.peNumber, dict(n = job.nodes))
+            if job.stdout:
+                print >>out, "#$ -o", job.stdout
+            if job.stderr:
+                print >>out, "#$ -e", job.stderr
+            for option in scheduler.qsubOptions:
+                print >>out, "#$", option
+            print >>out
+            print >>out, job.executable, ' '.join(job.arguments)
+            print >>out
+            if job.comments:
+                print >>out, "# ~~~~ comments ~~~~"
+                for line in job.comments:
+                    print >>out, "#", line
+            print >>out
+            print >>out, "# ~~~~ submit command ~~~~"
+            print >>out, "# %s < [script]" % scheduler.command
+            
+            return out.getvalue()
+    
+    return SGEBatchScriptTemplate()

Deleted: cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.tmpl
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.tmpl	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/scripts/sge/batch.sh.tmpl	2009-06-02 02:11:01 UTC (rev 15100)
@@ -1,41 +0,0 @@
-## -*- sh -*-
-#compiler-settings
-directiveStartToken = @
-#end compiler-settings
- at from pyre.schedulers import BatchScriptTemplate
- at extends BatchScriptTemplate
- at implements respond
- at set $self.substitutions = {'job.id': "$JOB_ID"}
-#$ -S ${scheduler.shell}
-#$ -cwd
-#$ -N ${job.task}
- at if $job.queue
-#$ -q ${job.queue}
- at end if
- at if max($job.walltime)
-#$ -l h_rt=@echo ("%d:%02d:%02d" % $job.walltime[0:3])
- at end if
-#$ -pe $scheduler.peName @echo eval($scheduler.peNumber, dict(n = $job.nodes))
- at if $self.stdout
-#$ -o ${self.stdout}
- at end if
- at if $self.stderr
-#$ -e ${self.stderr}
- at end if
- at for option in $scheduler.qsubOptions
-#$ ${option}
- at end for
-
- at set $self.substitutions = {'job.id': "${JOB_ID}"}
-
-${job.executable} @echo ' '.join($job.arguments)
-
- at if $job.comments
-# ~~~~ comments ~~~~
- at for line in $job.comments
-# ${line}
- at end for
- at end if
-
-# ~~~~ submit command ~~~~
-# ${scheduler.command} < [script]

Added: cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.odb
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.odb	                        (rev 0)
+++ cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.odb	2009-06-02 02:11:01 UTC (rev 15100)
@@ -0,0 +1,50 @@
+# -*- Python -*-
+
+def template():
+    from pyre.schedulers import BatchScriptTemplate
+
+    class SGEBatchScriptTemplate(BatchScriptTemplate):
+
+        def __init__(self):
+            BatchScriptTemplate.__init__(self, "tacc-ranger")
+        
+        def render(self):
+            from StringIO import StringIO
+
+            out = StringIO()
+            scheduler = self.scheduler
+            job = self.job
+            
+            print >>out, "#!%s" % scheduler.shell
+            print >>out, "#$ -S", scheduler.shell
+            print >>out, "#$ -V"
+            print >>out, "#$ -cwd"
+            print >>out, "#$ -N", job.task
+            if job.queue:
+                print >>out, "#$ -q", job.queue
+            if max(job.walltime):
+                print >>out, "#$ -l h_rt=%d:%02d:%02d" % job.walltime[0:3]
+            if job.stdout:
+                print >>out, "#$ -o", job.stdout
+            if job.stderr:
+                print >>out, "#$ -e", job.stderr
+            for option in scheduler.qsubOptions:
+                print >>out, "#$", option
+            print >>out, "#$ -pe", "%dway %d" % (scheduler.tpn, scheduler.cores)
+            print >>out
+            if job.nodes % scheduler.tpn:
+                print >>out, "export MY_NSLOTS=%d" % job.nodes
+            print >>out
+            print >>out, job.executable, ' '.join(job.arguments)
+            print >>out
+            if job.comments:
+                print >>out, "# ~~~~ comments ~~~~"
+                for line in job.comments:
+                    print >>out, "#", line
+            print >>out
+            print >>out, "# ~~~~ submit command ~~~~"
+            print >>out, "# %s < [script]" % scheduler.command
+            
+            return out.getvalue()
+    
+    return SGEBatchScriptTemplate()

Deleted: cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.tmpl
===================================================================
--- cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.tmpl	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/pyre/schedulers/scripts/tacc-ranger/batch.sh.tmpl	2009-06-02 02:11:01 UTC (rev 15100)
@@ -1,46 +0,0 @@
-## -*- sh -*-
-#compiler-settings
-directiveStartToken = @
-#end compiler-settings
- at from pyre.schedulers import BatchScriptTemplate
- at extends BatchScriptTemplate
- at implements respond
- at set $self.substitutions = {'job.id': "$JOB_ID"}
-#$ -S ${scheduler.shell}
-#$ -V
-#$ -cwd
-#$ -N ${job.task}
- at if $job.queue
-#$ -q ${job.queue}
- at end if
- at if max($job.walltime)
-#$ -l h_rt=@echo ("%d:%02d:%02d" % $job.walltime[0:3])
- at end if
- at if $self.stdout
-#$ -o ${self.stdout}
- at end if
- at if $self.stderr
-#$ -e ${self.stderr}
- at end if
- at for option in $scheduler.qsubOptions
-#$ ${option}
- at end for
-#$ -pe @echo '%dway %d' % ($scheduler.tpn, $scheduler.cores)
-
- at if $job.nodes % $scheduler.tpn
-export MY_NSLOTS=$job.nodes
- at end if
-
- at set $self.substitutions = {'job.id': "${JOB_ID}"}
-
-${job.executable} @echo ' '.join($job.arguments)
-
- at if $job.comments
-# ~~~~ comments ~~~~
- at for line in $job.comments
-# ${line}
- at end for
- at end if
-
-# ~~~~ submit command ~~~~
-# ${scheduler.command} < [script]

Modified: cs/pythia/trunk/setup.py
===================================================================
--- cs/pythia/trunk/setup.py	2009-06-01 20:34:37 UTC (rev 15099)
+++ cs/pythia/trunk/setup.py	2009-06-02 02:11:01 UTC (rev 15100)
@@ -7,7 +7,7 @@
 setup(
     
     name = 'pythia', 
-    version = '0.8.1.8',
+    version = '0.8.1.9',
 
     zip_safe = False,
     packages = find_packages(),
@@ -17,10 +17,6 @@
     entry_points = {
     },
     
-    install_requires = [
-        'Cheetah',
-    ],
-
     extras_require = {
 
     # * acis: "a set of Python bindings for ACIS, the solid modeler from Spatial"



More information about the CIG-COMMITS mailing list