コード例 #1
0
ファイル: workers.py プロジェクト: floli/flof
 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)
コード例 #2
0
ファイル: baseworker.py プロジェクト: floli/flof
 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
コード例 #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
コード例 #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
コード例 #5
0
ファイル: casecreator.py プロジェクト: floli/flof
    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
コード例 #6
0
 def do(self):
     """ Returns the do attribute. """
     return common.getboolean(self.config.get("do", "True"))
コード例 #7
0
ファイル: workers.py プロジェクト: floli/flof
 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)
コード例 #8
0
ファイル: baseworker.py プロジェクト: floli/flof
 def do(self):
     """ Returns the do attribute. """
     return common.getboolean(self.config.get("do", "True"))