Ejemplo n.º 1
0
 def run(self):
     fail_on_error = common.getboolean(
         self.config.get("fail_on_error", True))
     ret_code = self.start_process(self.cmd,
                                   no_shlex=True,
                                   raise_excpt=fail_on_error,
                                   shell=True)
     self.logger.info("External command %s return with %s.", self.cmd,
                      ret_code)
Ejemplo n.º 2
0
 def _logfilename(self):
     """ Returns a path for the case log file. Creates it, if not already existing. """
     if not common.getboolean(self.config.get("log", True)) or self.case is None:
         return None
                                  
     logfile = norm_path(self.case, "log/", self.config.tag)
     try:
         os.makedirs(os.path.dirname(logfile))
     except OSError:
         pass
     return logfile
Ejemplo n.º 3
0
    def _logfilename(self):
        """ Returns a path for the case log file. Creates it, if not already existing. """
        if not common.getboolean(self.config.get("log",
                                                 True)) or self.case is None:
            return None

        logfile = norm_path(self.case, "log/", self.config.tag)
        try:
            os.makedirs(os.path.dirname(logfile))
        except OSError:
            pass
        return logfile
Ejemplo n.º 4
0
    def cmd(self, args = ""):
        """ Construct the commandl line, including MPI run command, additional args can be supplied as a string. """
        cmd = self.config.attrib["name"]
        cmd += " -case %s" % self.case
        cmd += " " + args
        
        if common.getboolean(self.config.get("parallel", True)):
            num_proc = self.num_proc()
        else:
            num_proc = 0

        if num_proc > 0:
            cmd = self.context["mpi_command"].format(numProc=num_proc, command=app)

        return cmd
Ejemplo n.º 5
0
    def run(self):
        if os.path.isdir(self.case):
            if common.getboolean(self.config.get("overwrite", True)):
                shutil.rmtree(self.case)
            else:
                raise WorkerError("Case directory %s exists and overwrite == False" % self.case)
                                     

        self.copy_files()
        self.create_mesh()

        # There are two methods to create the boundary conditions. Either copy them from a zero time
        # directory of the template or create them from a <fields> node. These methods a mutually exclusice
        # The first encontered tag is used, the other one discarded.
        for tag in self.config:
            if tag.tag == "zeroTime":
                self.copy_0_time()
                break
            if tag.tag == "fields":
                self.create_BCs()
                break
Ejemplo n.º 6
0
 def do(self):
     """ Returns the do attribute. """
     return common.getboolean(self.config.get("do", "True"))
Ejemplo n.º 7
0
 def run(self):
     fail_on_error = common.getboolean(self.config.get("fail_on_error", True))
     ret_code = self.start_process(self.cmd, no_shlex=True, raise_excpt=fail_on_error, shell=True)
     self.logger.info("External command %s return with %s.", self.cmd, ret_code)
Ejemplo n.º 8
0
 def do(self):
     """ Returns the do attribute. """
     return common.getboolean(self.config.get("do", "True"))