[cig-commits] r4103 - in cs/framework/trunk/cig/addyndum: .
resources/scripts
leif at geodynamics.org
leif at geodynamics.org
Tue Jul 25 17:29:13 PDT 2006
Author: leif
Date: 2006-07-25 17:29:12 -0700 (Tue, 25 Jul 2006)
New Revision: 4103
Modified:
cs/framework/trunk/cig/addyndum/applications.py
cs/framework/trunk/cig/addyndum/contexts.py
cs/framework/trunk/cig/addyndum/resources/scripts/batch-script.tmpl
cs/framework/trunk/cig/addyndum/resources/scripts/mpi-script.tmpl
Log:
Updated Addyndum's generated Python scripts for eggs.
(Also threw-in my IPython.ultraTB blurb.)
Modified: cs/framework/trunk/cig/addyndum/applications.py
===================================================================
--- cs/framework/trunk/cig/addyndum/applications.py 2006-07-25 19:30:41 UTC (rev 4102)
+++ cs/framework/trunk/cig/addyndum/applications.py 2006-07-26 00:29:12 UTC (rev 4103)
@@ -222,18 +222,27 @@
def schedule(self, context):
- from os.path import join
+ from os.path import expanduser, join
# get the job
job = self.job
job.nodes = self.nodes
job.interpreter = open(self.interpreter, "r")
+ from __main__ import __requires__
+ from distutils.sysconfig import get_python_lib
+ cigprefix = expanduser(join("~", ".cig"))
+ cigpythondir = get_python_lib(plat_specific=False, prefix=cigprefix)
+ cigpyexecdir = get_python_lib(plat_specific=True, prefix=cigprefix)
+
# generate the main Python batch script
batchScriptTemplate = self.getTemplate("scripts/batch-script.tmpl")
batchScriptTemplate.script = self
batchScriptTemplate.className = self.__class__.__name__
batchScriptTemplate.module = self.__module__
+ batchScriptTemplate.requires = __requires__
+ batchScriptTemplate.cigpythondir = cigpythondir
+ batchScriptTemplate.cigpyexecdir = cigpyexecdir
job.scriptTemplate = batchScriptTemplate
@@ -242,6 +251,9 @@
mpiScriptTemplate.script = self
mpiScriptTemplate.className = self.__class__.__name__
mpiScriptTemplate.module = self.__module__
+ mpiScriptTemplate.requires = __requires__
+ mpiScriptTemplate.cigpythondir = cigpythondir
+ mpiScriptTemplate.cigpyexecdir = cigpyexecdir
job.mpiScriptTemplate = mpiScriptTemplate
Modified: cs/framework/trunk/cig/addyndum/contexts.py
===================================================================
--- cs/framework/trunk/cig/addyndum/contexts.py 2006-07-25 19:30:41 UTC (rev 4102)
+++ cs/framework/trunk/cig/addyndum/contexts.py 2006-07-26 00:29:12 UTC (rev 4103)
@@ -446,6 +446,22 @@
#
def executeApplication(self):
+
+ # Fire-up pdb and IPython when an exception occurs -- if IPython is available.
+ try:
+ import sys, IPython.ultraTB
+ if sys.stderr.isatty():
+ colorScheme = 'Linux'
+ else:
+ colorScheme = 'NoColor'
+ if sys.stdin.isatty() and sys.stdout.isatty() and sys.stderr.isatty():
+ callPdb = 1
+ else:
+ callPdb = 0
+ sys.excepthook = IPython.ultraTB.FormattedTB(mode='Verbose', color_scheme=colorScheme, call_pdb=callPdb)
+ except ImportError:
+ pass
+
self.application.onLoginNode(self)
Modified: cs/framework/trunk/cig/addyndum/resources/scripts/batch-script.tmpl
===================================================================
--- cs/framework/trunk/cig/addyndum/resources/scripts/batch-script.tmpl 2006-07-25 19:30:41 UTC (rev 4102)
+++ cs/framework/trunk/cig/addyndum/resources/scripts/batch-script.tmpl 2006-07-26 00:29:12 UTC (rev 4103)
@@ -3,6 +3,14 @@
directiveStartToken = @
#end compiler-settings
+__requires__ = '${requires}'
+import site
+site.addsitedir('${cigpythondir}')
+ at if $cigpyexecdir != $cigpythondir
+site.addsitedir('${cigpyexecdir}')
+ at end if
+import pkg_resources # setup sys.path
+
${prologue}
# batch script generated by ParallelScript
Modified: cs/framework/trunk/cig/addyndum/resources/scripts/mpi-script.tmpl
===================================================================
--- cs/framework/trunk/cig/addyndum/resources/scripts/mpi-script.tmpl 2006-07-25 19:30:41 UTC (rev 4102)
+++ cs/framework/trunk/cig/addyndum/resources/scripts/mpi-script.tmpl 2006-07-26 00:29:12 UTC (rev 4103)
@@ -3,6 +3,14 @@
directiveStartToken = @
#end compiler-settings
+__requires__ = '${requires}'
+import site
+site.addsitedir('${cigpythondir}')
+ at if $cigpyexecdir != $cigpythondir
+site.addsitedir('${cigpyexecdir}')
+ at end if
+import pkg_resources # setup sys.path
+
${prologue}
pythonZip = stageManager.stagedFile('python.zip')
More information about the cig-commits
mailing list