Salome HOME
[bos #32519][EDF] (2022-T3)
[modules/kernel.git] / src / Container / ScriptsTemplate / script_parameters.py
1 class ScriptLocalParameters:
2     def __init__(self, args):
3         self.debug = False
4         if args[0] == "-d":
5             self.debug = True
6             args = args[1:]
7
8         self.nb_proc = self._read_arg(args[0], "NULL")
9         self.workdir = self._read_arg(args[1], "NULL")
10         self.isTmpDir = True if args[2] == "1" else False
11         self.name_server = args[3]
12         self.container = args[4]
13         self.container_name = args[5]
14         self.libbatch_nodefile = self._read_arg(args[6], "NULL")
15         self.machine_file = self._read_arg(args[7], "NULL")
16         self.ompi_uri_file = self._read_arg(args[8], "NULL")
17
18         import platform
19         self.Windows = platform.system() == "Windows"
20
21     def _read_arg(self, value, null_value):
22         if value == null_value:
23             return None
24         return value
25
26     def __str__(self):
27         str = []
28         str.append("nb_proc: %s" % self.nb_proc)
29         str.append("workdir: %s" % self.workdir)
30         str.append("isTmpDir: %s" % self.isTmpDir)
31         str.append("name_server: %s" % self.name_server)
32         str.append("container: %s" % self.container)
33         str.append("container_name: %s" % self.container_name)
34         str.append("libbatch_nodefile: %s" % self.libbatch_nodefile)
35         str.append("machine_file: %s" % self.machine_file)
36         str.append("ompi_uri_file: %s" % self.ompi_uri_file)
37         str.append("--")
38         return "\n".join(str)