[cig-commits] r5258 - in cs/pythia/trunk: . mpi pyre/applications
pyre/schedulers
leif at geodynamics.org
leif at geodynamics.org
Mon Nov 13 19:20:24 PST 2006
Author: leif
Date: 2006-11-13 19:20:23 -0800 (Mon, 13 Nov 2006)
New Revision: 5258
Modified:
cs/pythia/trunk/mpi/Application.py
cs/pythia/trunk/mpi/__init__.py
cs/pythia/trunk/pyre/applications/Application.py
cs/pythia/trunk/pyre/applications/Executive.py
cs/pythia/trunk/pyre/schedulers/__init__.py
cs/pythia/trunk/setup.cfg
Log:
Pythia v0.8.1.0b4: Fixed bugs relating to MPI launching:
Fix sys.path/PYTHONPATH automatically; don't touch 'argv'
until after MPI_Init().
Modified: cs/pythia/trunk/mpi/Application.py
===================================================================
--- cs/pythia/trunk/mpi/Application.py 2006-11-14 03:17:09 UTC (rev 5257)
+++ cs/pythia/trunk/mpi/Application.py 2006-11-14 03:20:23 UTC (rev 5258)
@@ -37,17 +37,17 @@
def onLoginNode(self, *args, **kwds):
import sys
- from pkg_resources import resource_filename
- jobstart = resource_filename("pyre", "scripts/jobstart.py")
+ path = self.pathString()
+ requires = self.requires()
entry = self.entryName()
argv = self.getArgv(*args, **kwds)
# initialize the job
job = self.job
job.nodes = self.nodes
- job.executable = self.executable
- job.arguments = [jobstart, entry] + argv
+ job.executable = self.jobExecutable
+ job.arguments = ["--pyre-start", path, requires, "pyre.schedulers:jobstart", entry] + argv
# schedule
self.scheduler.schedule(job)
@@ -57,18 +57,17 @@
def onLauncherNode(self, *args, **kwds):
import sys
- from pkg_resources import resource_filename
- mpistart = resource_filename(__name__, "scripts/mpistart.py")
+ path = self.pathString()
+ requires = self.requires()
entry = self.entryName()
argv = self.getArgv(*args, **kwds)
# initialize the launcher
launcher = self.launcher
launcher.nodes = self.nodes
- self.getNodes()
- launcher.executable = self.executable
- launcher.arguments = [mpistart, entry] + argv
+ launcher.executable = self.mpiExecutable
+ launcher.arguments = ["--pyre-start", requires, path, "mpi:mpistart", entry] + argv
# launch
launcher.launch()
@@ -84,7 +83,12 @@
super(Application, self).__init__(name)
import sys
+ from os.path import join, split
+
self.executable = sys.executable
+ exe = split(self.executable)
+ self.jobExecutable = self.executable
+ self.mpiExecutable = join(exe[0], "mpi" + exe[1])
# end of file
Modified: cs/pythia/trunk/mpi/__init__.py
===================================================================
--- cs/pythia/trunk/mpi/__init__.py 2006-11-14 03:17:09 UTC (rev 5257)
+++ cs/pythia/trunk/mpi/__init__.py 2006-11-14 03:20:23 UTC (rev 5258)
@@ -25,24 +25,17 @@
import sys
from pyre.applications import start, AppRunner
- if argv is None:
- argv = sys.argv
- argv = [sys.executable] + argv
-
- MPI_Init(argv)
+ kwds = kwds.get('kwds', dict())
+ kwds['message'] = 'onComputeNodes'
- argv = argv[1:]
-
try:
start(argv,
applicationClass = AppRunner,
- kwds = dict(message = 'onComputeNodes'))
+ kwds = kwds)
except:
#MPI_Abort(MPI_COMM_WORLD, 1)
raise
- MPI_Finalize()
-
return 0
Modified: cs/pythia/trunk/pyre/applications/Application.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Application.py 2006-11-14 03:17:09 UTC (rev 5257)
+++ cs/pythia/trunk/pyre/applications/Application.py 2006-11-14 03:20:23 UTC (rev 5258)
@@ -155,6 +155,31 @@
return self.__class__.__module__ + ':' + self.__class__.__name__
+ def workingSet(self):
+ """Return the minimal working set for this application."""
+
+ from pkg_resources import WorkingSet, Environment, parse_requirements
+
+ requires = self.requires()
+ workingSet = WorkingSet([])
+ requirements = parse_requirements(requires)
+
+ for dist in workingSet.resolve(requirements, Environment()):
+ workingSet.add(dist)
+
+ return workingSet
+
+
+ def path(self):
+ """Return the minimal Python search path for this application."""
+ workingSet = self.workingSet()
+ return workingSet.entries
+
+
+ def pathString(self):
+ return ':'.join(self.path())
+
+
def __init__(self, name=None, facility=None):
Component.__init__(self, name, facility)
Executive.__init__(self)
Modified: cs/pythia/trunk/pyre/applications/Executive.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Executive.py 2006-11-14 03:17:09 UTC (rev 5257)
+++ cs/pythia/trunk/pyre/applications/Executive.py 2006-11-14 03:20:23 UTC (rev 5258)
@@ -52,10 +52,18 @@
import sys
argv = sys.argv
self.arg0 = argv[0]
+ self._requires = kwds.get('requires')
argv = argv[1:]
return argv
+ def requires(self):
+ if self._requires is None:
+ from __main__ import __requires__
+ self._requires = __requires__
+ return self._requires
+
+
def processCommandline(self, registry, argv=None, parser=None):
"""convert the command line arguments to a trait registry"""
@@ -110,6 +118,7 @@
def __init__(self):
self.arg0 = self.name
+ self._requires = None
# version
Modified: cs/pythia/trunk/pyre/schedulers/__init__.py
===================================================================
--- cs/pythia/trunk/pyre/schedulers/__init__.py 2006-11-14 03:17:09 UTC (rev 5257)
+++ cs/pythia/trunk/pyre/schedulers/__init__.py 2006-11-14 03:20:23 UTC (rev 5258)
@@ -41,9 +41,12 @@
import sys
from pyre.applications import start, AppRunner
+ kwds = kwds.get('kwds', dict())
+ kwds['message'] = 'onLauncherNode'
+
return start(argv,
applicationClass = AppRunner,
- kwds = dict(message='onLauncherNode'))
+ kwds = kwds)
# end of file
Modified: cs/pythia/trunk/setup.cfg
===================================================================
--- cs/pythia/trunk/setup.cfg 2006-11-14 03:17:09 UTC (rev 5257)
+++ cs/pythia/trunk/setup.cfg 2006-11-14 03:20:23 UTC (rev 5258)
@@ -1,4 +1,4 @@
[egg_info]
-tag_build = b3
+tag_build = b4
#tag_svn_revision = 1
More information about the cig-commits
mailing list