def onClient(self): name = self.clientName import journal journal.info(name).activate() # journal.debug(name).activate() journal.info('pickler').activate() # journal.debug('pickler').activate() # instantiate the client import pyre.ipa client = pyre.ipa.session(name) # configure it self.configureComponent(client) # initialize it client.init() # get a ticket ticket = client.login("aivazis", "mga4demo") print "got ticket:", ticket # refresh it ticket = client.refresh("aivazis", ticket) print "got new ticket:", ticket # logout response = client.logout("aivazis", ticket) print "got:", response return
def test(): """ Verify that channels lower in the hierarchy inherit the default state of their parent """ # get the journal import journal # make a channel parent = journal.info(name="test.index.parent") # verify that the state is on assert parent.active is True # it's non-fatal assert parent.fatal is False # and the device is at the default value assert parent.device is journal.info.chronicler.device # deactivate it parent.active = False # make it fatal parent.fatal = True # and set the device to a trash can parent.device = journal.trash() # lookup a name that is lower in the hierarchy child = journal.info(name="test.index.parent.blah.blah.child") # that it's state is the same as the parent assert child.active == parent.active assert child.fatal == parent.fatal # and that it inherited the device correctly assert child.device is parent.device # all done return
def onServer(self): name = 'journal' # turn on my channels so we can watch what happens import journal journal.info(name).activate() journal.debug(name).activate() # build the registry settings registry = self.createRegistry() registry.name = 'root' node = registry.getNode(name) node.setProperty('port', self.port, self.inventory.getTraitDescriptor('port').locator) marshaller = node.getNode('marshaller') marshaller.setProperty('key', self.key, None) # instantiate the services service = journal.service(name) # configure it self.configureComponent(service, registry) # initialize it service.init() # enter the indefinite loop waiting for requests service.serve() return
def main(): from opal.applications.CGI import CGI class CmdlineApp(CGI): def main(self): import os import sys print '<pre>' print sys.argv print '</pre>' print '<pre>' for key, value in os.environ.iteritems(): print ' %s = {%s}' % (key, value) print '</pre>' print '<pre>' print self.registry.render() print '</pre>' return def __init__(self): CGI.__init__(self, 'cmdline') return import journal journal.info('opal.cmdline').activate() journal.debug('opal.commandline').activate() app = CmdlineApp() return app.run()
def main(): from opal.applications.CGI import CGI class HelloApp(CGI): class Inventory(CGI.Inventory): import pyre.inventory name = pyre.inventory.str("name", default="world") name.meta['tip'] = "the target of the greeting" def main(self): import os pid = os.getpid() euid = os.geteuid() uid = os.getuid() print '<pre>' print 'content: {%s}' % self.content print "(%d, %s): Hello %s!" % (pid, uid, self.inventory.name) print '</pre>' return def __init__(self): CGI.__init__(self, 'hello') return import journal journal.info('opal.cmdline').activate() journal.debug('opal.commandline').activate() app = HelloApp() return app.run()
def main(): #debug.activate() import journal journal.info('mpirun').activate() pytests = pysuite() alltests = unittest.TestSuite( (pytests, ) ) res = unittest.TextTestRunner(verbosity=2).run(alltests) import sys; sys.exit(not res.wasSuccessful())
def main(): #debug.activate() import journal journal.info('mpirun').activate() pytests = pysuite() alltests = unittest.TestSuite((pytests, )) res = unittest.TextTestRunner(verbosity=2).run(alltests) import sys sys.exit(not res.wasSuccessful())
def main(): import journal journal.info('ssher').activate() journal.debug('dds').activate() pytests = pysuite() alltests = unittest.TestSuite((pytests, )) unittest.TextTestRunner(verbosity=2).run(alltests) return
def __init__(self, name): Script.__init__(self, name) self._connection = None self._marshaller = None import journal journal.info("pyre.ipc.connection").activate() return
def main(): name = 'harness' import journal journal.info(name).activate() journal.debug(name).activate() from pyre.applications.ServiceHarness import ServiceHarness app = ServiceHarness(name) return app.run()
def journald(name=None): if name is None: name = "journald" import journal journal.info("journal").activate() journal.debug("journal").activate() journal.info("journald").activate() journal.debug("journald").activate() app = journal.daemon(name) app.run()
def onServer(self): name = 'ipa' # turn on my channels so we can watch what happens import journal journal.info(name).activate() # journal.debug(name).activate() journal.info("user-manager").activate() # journal.debug("user-manager").activate() # build the registry settings registry = self.createRegistry() registry.name = 'root' node = registry.getNode(name) node.setProperty('port', self.port, None) marshaller = node.getNode('marshaller') marshaller.setProperty('key', self.key, None) userManager = node.getNode('user-manager') userManager.setProperty('passwd', 'userdb.md5', None) # instantiate the services import pyre.ipa service = pyre.ipa.service(name) service.weaver = self.weaver # configure it self.configureComponent(service, registry) # initialize it service.init() # client configuration registry = self.createRegistry() serviceRegistry = registry.getNode(self.clientName) service.generateClientConfiguration(serviceRegistry) stream = file(self.clientName + '.pml', 'w') document = self.weaver.render(registry) print >> stream, "\n".join(document) stream.close() # enter the indefinite loop waiting for requests service.serve() return
def compilers(self, plexus, **kwds): """ Display information about the chosen compilers """ # make a channel channel = journal.info("merlin.info.host") # indentation indent = " " * 2 # get the list of compilers compilers = plexus.compilers # if there are any if compilers: # sign on channel.line(f"{indent*0}compilers:") # go through them for compiler in compilers: # report channel.line(f"{indent*1}{compiler}") channel.line(f"{indent*2}driver: {compiler.driver}") channel.line(f"{indent*2}version: {'.'.join(compiler.version())}") # flush channel.log() # all done return
def dump(self, plexus, **kwds): """ Display the contents of the offsets product """ # make a channel channel = journal.info("ampcor.offsets.dump") # get the output offsets = self.flow.offsetMap # open its raster offsets.open(mode="r") # build a set of indices that visit the map in layout order for idx in itertools.product(*map(range, offsets.shape)): # get the cell p = offsets[idx] # show me channel.line(f"offsets{idx}:") channel.line(f" ref: {tuple(p.ref)}") channel.line(f" shift: {tuple(p.delta)}") channel.line(f" gamma: {p.gamma}") channel.line(f" confidence: {p.confidence}") channel.line(f" snr: {p.snr}") channel.line(f" covariance: {p.covariance}") channel.log() # all done return 0
def nfs(self, plexus, **kwds): """ Dump the application configuration namespace """ # make a channel channel = journal.info("{project.name}.cli.nfs") # set up the indentation level indent = " " * 2 # get the prefix prefix = "{project.name}" if self.root is None else self.root # and the name server nameserver = self.pyre_nameserver # get all nodes that match my {{prefix}} for info, node in nameserver.find(pattern=prefix): # attempt to try: # get the node value value = node.value # if anything goes wrong except nameserver.NodeError as error: # use the error message as the value value = f" ** ERROR: {{error}}" # inject channel.line(f"{{indent}}{{info.name}}: {{value}}") # flush channel.log() # all done return 0
def __init__(self, name=None, **kwds): # chain up super().__init__(name=name, **kwds) # attach my renderer to the console import journal journal.console.renderer = self.pyre_renderer # make a name for my channels channel = self.pyre_namespace or name # if I have a name if channel: # build my channels self.debug = journal.debug(channel) self.firewall = journal.firewall(channel) self.info = journal.info(channel).activate() self.warning = journal.warning(channel).activate() self.error = journal.error(channel).activate() # if i am in debugging mode if self.DEBUG: # activate the debug channel self.debug.active = True # sniff around for my environment self.pyre_home, self.pyre_prefix, self.pyre_defaults = self.pyre_explore() # instantiate my layout self.layout = self.pyre_loadLayout() # mount my folders self.pfs = self.pyre_mountPrivateFilespace() # go through my requirements and build my dependency map # self.dependencies = self.pyre_resolveDependencies() # all done return
def platform(self, plexus, **kwds): """ Display information about the platform """ # get the host host = self.pyre_host # unpack distribution = host.distribution release = host.release codename = host.codename arch = host.cpus.architecture tag = f"{{host.tag}}" # make a channel channel = journal.info("{project.name}.info.platform") # report channel.line(f"os: {{distribution}} {{release}} ({{codename}})") channel.line(f"arch: {{arch}}") channel.line(f"tag: {{tag}}") # flush channel.log() # all done return
def languages(self, plexus, **kwds): """ Display information about the known source languages """ # get the language protocol language = merlin.protocols.language # assemble its implementors languages = tuple( name for _, name, _ in language.pyre_locateAllImplementers(namespace="merlin") ) # marker indent = " " * 2 # make a channel channel = journal.info("merlin.info.host") # report channel.line(f"{indent*0}languages:") for name in languages: channel.line(f"{indent*1}{name}") # flush channel.log() # all done return
def info(): d = journal.info("foo") d.active = True d.log("here is some information") # also from C++ journal.extension.infoTest("foo") return
def test(): """ Verify access to the channel metadata """ # access import journal # make a channel channel = journal.info("test.channel") # get its metadata notes = channel.notes # adjust the application name notes["application"] = "info_notes" # add something notes["author"] = "michael" # make sure the adjustments stick by asking for the notes once again; this step is # non-trivial: if support is provided by the C++ library, it ensures that the notes are # mutable notes = channel.notes # and comparing against expectations assert notes["application"] == "info_notes" assert notes["author"] == "michael" assert notes["channel"] == "test.channel" assert notes["severity"] == "info" # all done return
def __init__(self, name=None, timer=None, **kwds): # chain up super().__init__(name=name, **kwds) # i may not have a name, but i need one in what follows name = name or self.pyre_family() or "pyre.nexus.peers" # if i didn't get handed a timer to use if timer is None: # make a new one timer = self.pyre_executive.newTimer(name=name) # start it timer.start() # save it self.timer = timer # journal channels import journal self.info = journal.info(name=name) self.debug = journal.debug(name=name) self.warning = journal.warning(name=name) self.error = journal.error(name=name) # all done return
def __init__(self, name=None): Traceable.__init__(self) if name is None: name = self.name # class attribute else: self.name = name self.inventory = self.createInventory() # provide simple, convenient access to descriptors self.metainventory = self.createMetaInventory() # other names by which I am known for configuration purposes self.aliases = [ name ] import journal self._debug = journal.debug(name) self._info = journal.info(name) self._error = journal.error(name) self._warning = journal.warning(name) # modify the inventory defaults that were hardwired at compile time # gives derived components an opportunity to modify their default behavior # from what was inherited from their parent's inventory self._defaults() return
def hello(): # make a channel channel = journal.info("isce3.ampcor.correlate") # say something channel.log("hello!") # all done return
def platform(self, plexus, **kwds): """ Display information about the platform """ # indentation indent = " " * 2 # get the host host = self.pyre_host # unpack distribution = host.distribution release = host.release codename = host.codename arch = host.cpus.architecture tag = f"{host.tag}" # make a channel channel = journal.info("merlin.info.platform") # report channel.line(f"{indent*0}os: {distribution} {release} ({codename})") channel.line(f"{indent*0}arch: {arch}") channel.line(f"{indent*0}tag: {tag}") # flush channel.log() # all done return
def __init__(self, name=None, **kwds): # chain up super().__init__(name=name, **kwds) # set up my nickname nickname = self.pyre_namespace or name # if i have one if nickname: # register it with the journal journal.application(name=nickname) # build my channels self.debug = journal.debug(nickname) self.firewall = journal.firewall(nickname) self.info = journal.info(nickname).activate() self.warning = journal.warning(nickname).activate() self.error = journal.error(nickname).activate() # if i am in debugging mode if self.DEBUG: # activate the debug channel self.debug.active = True # sniff around for my environment self.pyre_home, self.pyre_prefix, self.pyre_defaults = self.pyre_explore( ) # instantiate my layout self.layout = self.pyre_loadLayout() # mount my folders self.pfs = self.pyre_mountPrivateFilespace() # go through my requirements and build my dependency map # self.dependencies = self.pyre_resolveDependencies() # all done return
def test(): """ Sanity check: verify that the channel is accessible """ # get the journal import journal # make a channel channel = journal.info(name="tests.journal.info") # verify the channel name assert channel.name == "tests.journal.info" # the detail should be at the default level assert channel.detail == 1 # the channel should be active assert channel.active == True # and non fatal assert channel.fatal == False # the page should be empty assert list(channel.page) == [] # verify the metadata assert channel.notes["application"] == "journal" assert channel.notes["channel"] == channel.name assert channel.notes["severity"] == channel.severity # all done return
def __init__(self, name=None, timer=None, **kwds): # chain up super().__init__(name=name, **kwds) # i am not have a name, but i need one in what follows name = name or self.pyre_family() or "pyre.nexus.peers" # if i were handed a timer to use if timer is not None: # save it self.timer = timer # otherwise else: # make a new one and start it self.timer = self.pyre_executive.newTimer(name=name).start() # journal channels import journal self.info = journal.info(name=name) self.debug = journal.debug(name=name) self.warning = journal.warning(name=name) self.error = journal.error(name=name) # all done return
def __init__(self, name=None, **kwds): # chain up super().__init__(name=name, **kwds) # attach my renderer to the console import journal journal.console.renderer = self.pyre_renderer # make a name for my channels channel = self.pyre_namespace or name # if I have a name if channel: # build my channels self.debug = journal.debug(channel) self.firewall = journal.firewall(channel) self.info = journal.info(channel).activate() self.warning = journal.warning(channel).activate() self.error = journal.error(channel).activate() # if i am in debugging mode if self.DEBUG: # activate the debug channel self.debug.active = True # sniff around for my environment self.pyre_home, self.pyre_prefix, self.pyre_defaults = self.pyre_explore( ) # instantiate my layout self.layout = self.pyre_loadLayout() # mount my folders self.pfs = self.pyre_mountPrivateFilespace() # go through my requirements and build my dependency map # self.dependencies = self.pyre_resolveDependencies() # all done return
def test(): """ Exercise the common case with a fatal channel """ # get the journal import journal # make a channel channel = journal.info(name="tests.journal.info") # make it fatal channel.fatal = True # send the output to the trash channel.device = journal.trash() # add some metadata channel.notes["time"] = "now" # we asked for this to be fatal, so carefully try: # to inject something channel.line("info channel:") channel.log(" hello world!") # this should be unreachable assert False, "unreachable" # if all goes well except channel.ApplicationError: # all good pass # all done return
def test(): """ Verify access to the channel properties """ # access import journal # make a channel channel = journal.info("test.channel") # verify its name assert channel.name == "test.channel" # check that it is read-only try: # by attempting to modify channel.name = "foo" # hence, we can't get here assert False, "unreachable" # if all goes well except AttributeError as error: # no problem pass # verify its detail is at 1 by default assert channel.detail == 1 # that it can be modified channel.detail = 5 # and the assignment sticks assert channel.detail == 5 # verify its activation state is on by default assert channel.active is True # that it can be modified channel.active = False # and the assignment sticks assert channel.active is False # verify its not fatal assert channel.fatal is False # that it can be modified channel.fatal = True # and the assignment sticks assert channel.fatal is True # verify that the accessible device is the console assert channel.device.name == "cout" # make a trash can trash = journal.trash() # register it as the device channel.device = trash # and verify that the assignment sticks assert channel.device is trash # check the name assert channel.device.name == "trash" # and verify that it's different from the default device held by the class assert channel.device is not channel.defaultDevice # all done return
def __init__(self, name, facility): Configurable.__init__(self, name) self.facility = facility import journal self._info = journal.info(self.name) self._debug = journal.debug(self.name) return
def adjust(self, box, **kwds): """ Compute the portion of the offset map between a pair of rasters given by {box} """ # get the {grid} bindings libgrid = ampcor.libpyre.grid # so we can grab the constructors for {layout} packing2d = libgrid.Canonical2D # {index} index2d = libgrid.Index2D # and {shape} shape2d = libgrid.Shape2D # make a timer timer = ampcor.executive.newTimer(name="ampcor.cuda.sequential") # and a journal channel channel = journal.info("ampcor.cuda.timings.sequential") # grab a device device = cuda.manager.devices[-1] # make it the active one cuda.manager.device(did=device.id) # compute the memory requirements required = 4 * self.plan.arena(box=box) # figure out how much memory we have available = 0.9 * device.globalMemory # compute the number of batches, assuming memory is the limiting resource batches = math.ceil(required / available) # get the starting row of the plan rowOrigin = box.origin[0] # get the shape of the rows rowShape = box.shape[0] # get the row index of one passed the last one rowEnd = rowOrigin + rowShape # compute the row step rowStep = rowShape // batches # go through the {box} in batches for row in range(rowOrigin, rowEnd, rowStep): # form an index that points to the beginning of this batch origin = index2d(index=(row, 0)) # and a shape that covers this batch shape = shape2d(shape=(min(rowStep, rowEnd - row), box.shape[1])) # use them to specify the workload workload = packing2d(origin=origin, shape=shape) # do the work self.worker.adjust(box=workload) # stop the timer timer.stop() # show me channel.log( f"[{self.rank}]: computed offsets: {1e3 * timer.read():.3f} ms") # all done return
def run(cfg: dict, out_paths: dict, run_steps: dict): ''' Run INSAR workflow with parameters in cfg dictionary ''' info_channel = journal.info("insar.run") info_channel.log("starting INSAR") t_all = time.time() if run_steps['bandpass_insar']: bandpass_insar.run(cfg) if run_steps['h5_prep']: h5_prep.run(cfg) if run_steps['rdr2geo']: rdr2geo.run(cfg) if run_steps['geo2rdr']: geo2rdr.run(cfg) if run_steps['coarse_resample']: resample_slc.run(cfg, 'coarse') if (run_steps['dense_offsets']) and \ (cfg['processing']['dense_offsets']['enabled']): dense_offsets.run(cfg) if run_steps['rubbersheet'] and \ cfg['processing']['rubbersheet']['enabled']: rubbersheet.run(cfg, out_paths['RIFG']) # If enabled, run fine_resampling if run_steps['fine_resample'] and \ cfg['processing']['fine_resample']['enabled']: resample_slc.run(cfg, 'fine') # If fine_resampling is enabled, use fine-coregistered SLC # to run crossmul if run_steps['crossmul']: if cfg['processing']['fine_resample']['enabled']: crossmul.run(cfg, out_paths['RIFG'], 'fine') else: crossmul.run(cfg, out_paths['RIFG'], 'coarse') # Run insar_filter only if run_steps['filter_interferogram'] and \ cfg['processing']['filter_interferogram']['filter_type'] != 'no_filter': filter_interferogram.run(cfg, out_paths['RIFG']) if run_steps['unwrap'] and 'RUNW' in out_paths: unwrap.run(cfg, out_paths['RIFG'], out_paths['RUNW']) if run_steps['geocode'] and 'GUNW' in out_paths: geocode_insar.run(cfg, out_paths['RUNW'], out_paths['GUNW']) t_all_elapsed = time.time() - t_all info_channel.log(f"successfully ran INSAR in {t_all_elapsed:.3f} seconds")
def getnumberofevents( eventdatafilename ): import journal, os info = journal.info('getnumberofevents') info.log( "eventdatafilename = %s" % eventdatafilename ) nbytes = os.path.getsize( eventdatafilename ) nevents = nbytes/8 info.log( "number of bytes = %s" % nbytes ) info.log( "number of events = %s" % nevents ) return nevents
def __init__(self, name): self.codecs = {} tag = name + '.curator' import journal self._info = journal.info(tag) self._debug = journal.debug(tag) return
def info(message): """ Generate an informational message """ # get the logging mechanism import journal # build an informational message object in my namespace info = journal.info('merlin') # log and return return info.log(message)
def main(self, *args, **kwds): import journal journal.info("pyre.ipc.connection").activate() host = self.inventory.host port = self.inventory.port protocol = self.inventory.protocol import pyre.ipc connection = pyre.ipc.connection(protocol) connection.connect((self.inventory.host, self.inventory.port)) outstream = connection.makefile("wb") import pickle hello = pickle.dumps("Hello world!") outstream.write(hello) outstream.flush() return
def test(): # access the package import journal # build a info channel info = journal.info("journal.test1") # verify that it is on by default assert info.active == True # disable it info.active = False # access the same channel through another object clone = journal.info("journal.test1") # verify that it is now off assert clone.active == False # build a info channel with a different name another = journal.info("journal.test2") # verify that it is on by default, to make sure that there is no crosstalk between channels assert another.active == True # all done return
def __init__(self, name="integratorelasticity"): """ Constructor. """ Integrator.__init__(self) self.output = None self.availableFields = None self.name = "Integrator Elasticity" # Setup journal (not a Component, so not setup already) import journal self._info = journal.info(name) return
def main(): from opal.applications.CGI import CGI class HelloApp(CGI): class Inventory(CGI.Inventory): import pyre.inventory name = pyre.inventory.str("name", default="world") name.meta['tip'] = "the target of the greeting" def main(self): import os pid = os.getpid() euid = os.geteuid() uid = os.getuid() print '<pre>' print "(%d, %s): Hello %s!" % (pid, uid, self.inventory.name) print '</pre>' return def __init__(self): CGI.__init__(self, 'hello') return import journal journal.info('opal.cmdline').activate() journal.debug('opal.commandline').activate() app = HelloApp() return app.run()
def test(): # access the package import journal # build a info channel info = journal.info("activation") # verify that it is on by default, activated from a configuration source assert info.active == True # disable it info.active = False # access the same channel through another object clone = journal.info("activation") # verify that it is off assert clone.active == False # enable it clone.active = True # check that the other channel has been activated as well assert info.active == True # all done return
def test(): # access the package import journal # build a info channel info = journal.info("journal.test1") # deactivate it info.active = False # and make it say something info.log("hello world!") # all done return
def onClient(self): name = self.clientName import journal journal.info(name).activate() # journal.debug(name).activate() journal.info('pickler').activate() # journal.debug('pickler').activate() # instantiate the client import pyre.idd client = pyre.idd.session(name) # configure it self.configureComponent(client) # initialize it client.init() # get a token token = client.token() print "got token:", token return
def test(): import journal # install our renderer renderer = Logger() journal.journal().device.renderer = renderer info = journal.info("test") info.log("Hello world not!") info.activate() info.log("Hello world!") info.deactivate() info.log("Hello world again!") return
def __init__(self, name): Traceable.__init__(self) self.name = name self.inventory = self.createInventory() # other names by which I am known for configuration purposes self.aliases = [ name ] import journal self._info = journal.info(name) self._debug = journal.debug(name) # modify the inventory defaults that were hardwired at compile time # gives derived components an opportunity to modify their default behavior # from what was inherited from their parent's inventory self._defaults() return
def test(): # access the package import journal # build a channel of each kind using the same name debug = journal.debug("journal.test") firewall = journal.firewall("journal.test") info = journal.info("journal.test") warning = journal.warning("journal.test") error = journal.error("journal.test") # check their expected default state assert debug.active == False assert firewall.active == True assert info.active == True assert warning.active == True assert error.active == True # all done return
def test(): import journal from jtest import jtest print " ** testing C++ informationals" info = journal.info("jtest") info.activate() jtest.info("jtest") print " ** testing C++ warnings" warning = journal.warning("jtest") #warning.deactivate() warning = jtest.warning("jtest") print " ** testing C++ errors" error = journal.error("jtest") #error.deactivate() jtest.error("jtest") return
def test(): import journal # force the initialization journal.journal() from jtest import jtest print " ** testing informationals" info = journal.info("jtest") info.activate() info.log("this is an info from python") jtest.info("jtest") print " ** testing warnings" warning = journal.warning("jtest") warning.log("this a warning from python") #jtest.warning("jtest") print " ** testing errors" error = journal.error("jtest") error.log("this an error from python") #jtest.error("jtest") return
# main if __name__ == "__main__": import mpi # testing Exchangermodule.so import ExchangerLib if not mpi.world().rank: print ExchangerLib.copyright() print dir(ExchangerLib) import journal #journal.debug("Array2D").activate() journal.debug("Exchanger").activate() journal.info(" X").activate() journal.info(" proc").activate() journal.info(" bid").activate() app = TestExchanger("test") app.main() # version __id__ = "$Id$" # End of file
# -*- Python -*- # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # California Institute of Technology # (C) 2007-2009 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # import journal info = journal.info( 'scheduler' ) def schedule( job, director ): # copy local job directory to server server = director.clerk.dereference(job.server) server_jobpath = director.dds.abspath(job, server=server) # the server server = job.server.dereference(director.clerk.db) # the scheduler scheduler = schedulerfactory( server ) launch = lambda cmd: director.csaccessor.execute( cmd, server, server_jobpath, suppressException=True) scheduler = scheduler(launch, prefix = 'source ~/.vnf' ) # submit job through scheduler
# # Jiao Lin # California Institute of Technology # (C) 2007 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ## Supports for parallel computing import journal info = journal.info( 'mpi' ) class ParallelComponent(object): '''Base class for operators that can be parallelized. ''' try: import mpi world = mpi.world() mpiRank = world.rank; mpiSize = world.size if mpiSize < 1: mpiSize = 1 parallel = False else:
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation) # Copyright (c) 1997-2016 California Institute of Technology. # License: 3-clause BSD. The full license text is available at: # - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/pyina/LICENSE """ Similar to test_mogi2, but with capabilities factored into a MasterSlaveController class """ raise NotImplementedError, "tests the desired (i.e. future) mpisolver interface..." from pyina.solvers import mpisolver import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S') if __name__ == "__main__": import journal journal.info("mpirun").activate() journal.debug("simple").activate() #journal.debug("pyina.receiveString").activate() from mystic.models import mogi; forward_mogi = mogi.evaluate app = mpisolver.MasterSlaveController() app.forward_model = forward_mogi app.inventory.launcher.inventory.nodes = 4 app.run() # End of file