def run(self, config, year):
     """Running MATSim.  A lot of paths are relative; the base path is ${OPUS_HOME}/opus_matsim.  As long as ${OPUS_HOME}
     is correctly set and the matsim tarfile was unpacked in OPUS_HOME, this should work out of the box.  There may eventually
     be problems with the java version.
     """
     try:
         import pydevd
         pydevd.settrace()
     except: pass
     
     logger.start_block("Starting RunTravelModel.run(...)")
     
     self.setUp( config )
     
     config_obj = MATSimConfigObject(config, year, self.matsim_config_full)
     config_obj.marschall()
     
     cmd = """cd %(opus_home)s/opus_matsim ; java %(vmargs)s -cp %(classpath)s %(javaclass)s %(matsim_config_file)s""" % {
             'opus_home': os.environ['OPUS_HOME'],
             'vmargs': "-Xmx2000m",
             'classpath': "libs/log4j/log4j/1.2.15/log4j-1.2.15.jar:libs/jfree/jfreechart/1.0.7/jfreechart-1.0.7.jar:libs/jfree/jcommon/1.0.9/jcommon-1.0.9.jar:classesMATSim:classesToronto:classesTNicolai:classesKai:classesEntry", #  'classpath': "classes:jar/MATSim.jar",
             'javaclass': "playground.run.Matsim4Urbansim",
             'matsim_config_file': self.matsim_config_full } 
     
     logger.log_status('Running command %s' % cmd ) 
     
     cmd_result = os.system(cmd)
     if cmd_result != 0:
         error_msg = "Matsim Run failed. Code returned by cmd was %d" % (cmd_result)
         logger.log_error(error_msg)
         logger.log_error("Note that currently (dec/08), paths in the matsim config files are relative to the opus_matsim root,")
         logger.log_error("  which is one level 'down' from OPUS_HOME.")
         raise StandardError(error_msg)        
     
     logger.end_block()
Exemple #2
0
    def run(self, config, year):
        """Running MATSim.  A lot of paths are relative; the base path is ${OPUS_HOME}/opus_matsim.  As long as ${OPUS_HOME}
        is correctly set and the matsim tarfile was unpacked in OPUS_HOME, this should work out of the box.  There may eventually
        be problems with the java version.
        """

        logger.start_block("Starting RunTravelModel.run(...)")

        # tnicolai :for debugging
        # try:
        #    import pydevd
        #    pydevd.settrace()
        # except: pass

        self.__setUp(config)

        config_obj = MATSimConfigObject(config, year, self.matsim_config_full)
        config_obj.marschall()

        # tnicolai: original call
        # cmd = """cd %(opus_home)s/opus_matsim ; java %(vmargs)s -cp %(classpath)s %(javaclass)s %(matsim_config_file)s""" % {
        #        'opus_home': paths.OPUS_HOME,
        #        'vmargs': "-Xmx2000m",
        #        'classpath': "libs/log4j/log4j/1.2.15/log4j-1.2.15.jar:libs/jfree/jfreechart/1.0.7/jfreechart-1.0.7.jar:libs/jfree/jcommon/1.0.9/jcommon-1.0.9.jar:classesMATSim:classesToronto:classesTNicolai:classesKai:classesEntry", #  'classpath': "classes:jar/MATSim.jar",
        #        'javaclass': "playground.tnicolai.urbansim.cupum.MATSim4UrbansimCUPUM",
        #        'matsim_config_file': self.matsim_config_full,
        #        'test_parameter': self.test_parameter }

        # tnicolai : test for matsim jar execution ...
        cmd = (
            """cd %(opus_home)s/opus_matsim ; java %(vmargs)s -cp %(classpath)s %(javaclass)s %(matsim_config_file)s %(test_parameter)s"""
            % {
                "opus_home": paths.OPUS_HOME,
                "vmargs": "-Xmx8000m",  # set to 8GB on math cluster and 2GB on Notebook
                "classpath": "jar/matsim4urbansim.jar",
                "javaclass": "playground.tnicolai.urbansim.cupum.MATSim4UrbansimCUPUM",
                "matsim_config_file": self.matsim_config_full,
                "test_parameter": self.test_parameter,
            }
        )

        logger.log_status("Running command %s" % cmd)

        cmd_result = os.system(cmd)
        if cmd_result != 0:
            error_msg = "Matsim Run failed. Code returned by cmd was %d" % (cmd_result)
            logger.log_error(error_msg)
            logger.log_error(
                "Note that currently (dec/08), paths in the matsim config files are relative to the opus_matsim root,"
            )
            logger.log_error("  which is one level 'down' from OPUS_HOME.")
            raise StandardError(error_msg)

        logger.end_block()
Exemple #3
0
    def run(self, config, year):
        """Running MATSim.  A lot of paths are relative; the base path is ${OPUS_HOME}/opus_matsim.  As long as ${OPUS_HOME}
        is correctly set and the matsim tarfile was unpacked in OPUS_HOME, this should work out of the box.  There may eventually
        be problems with the java version.
        """
        try:
            import pydevd
            pydevd.settrace()
        except:
            pass

        logger.start_block("Starting RunTravelModel.run(...)")

        self.setUp(config)

        config_obj = MATSimConfigObject(config, year, self.matsim_config_full)
        config_obj.marschall()

        cmd = """cd %(opus_home)s/opus_matsim ; java %(vmargs)s -cp %(classpath)s %(javaclass)s %(matsim_config_file)s""" % {
            'opus_home': os.environ['OPUS_HOME'],
            'vmargs': "-Xmx2000m",
            'classpath':
            "libs/log4j/log4j/1.2.15/log4j-1.2.15.jar:libs/jfree/jfreechart/1.0.7/jfreechart-1.0.7.jar:libs/jfree/jcommon/1.0.9/jcommon-1.0.9.jar:classesMATSim:classesToronto:classesTNicolai:classesKai:classesEntry",  #  'classpath': "classes:jar/MATSim.jar",
            'javaclass': "playground.run.Matsim4Urbansim",
            'matsim_config_file': self.matsim_config_full
        }

        logger.log_status('Running command %s' % cmd)

        cmd_result = os.system(cmd)
        if cmd_result != 0:
            error_msg = "Matsim Run failed. Code returned by cmd was %d" % (
                cmd_result)
            logger.log_error(error_msg)
            logger.log_error(
                "Note that currently (dec/08), paths in the matsim config files are relative to the opus_matsim root,"
            )
            logger.log_error("  which is one level 'down' from OPUS_HOME.")
            raise StandardError(error_msg)

        logger.end_block()