3 class ScriptRemoteParameters:
4 def __init__(self, args):
6 self.debug = KernelBasis.VerbosityActivated()
7 self.protocol = args[0]
8 self.user = self._read_arg(args[1], "NULL")
9 self.host = self._read_arg(args[2], "NULL")
10 self.appli = self._read_arg(args[3], "NULL")
11 self.workdir = self._read_arg(args[4], "NULL")
12 self.ssl = True if args[5] == "1" else False
15 self.remote_script = self._read_arg(args[8], "NULL")
16 self.naming_service = self._read_arg(args[9], "NULL")
17 self.appli_mode = args[10]
20 self.Windows = platform.system() == "Windows"
22 def _read_arg(self, value, null_value):
23 if value == null_value:
29 str.append("protocol: %s" % self.protocol)
30 str.append("user: %s" % self.user)
31 str.append("hostname: %s" % self.host)
32 str.append("appli: %s" % self.appli)
33 str.append("workdir: %s" % self.workdir)
34 str.append("ssl: %s" % self.ssl)
35 str.append("nshost: %s" % self.nshost)
36 str.append("nsport: %s" % self.nsport)
37 str.append("remote_script: %s" % self.remote_script)
38 str.append("naming_service: %s" % self.naming_service)
39 str.append("appil_mode: %s" % self.appli_mode)
43 # ----------------------------------------------
46 options = ScriptRemoteParameters(args)
48 KernelBasis.WriteInStdout( str(options) )
50 # build command depending on protocol
52 envd = (options.protocol != "srun")
54 if options.protocol == "rsh":
58 cmd.append("-l " + options.user)
59 cmd.append(options.host)
61 elif options.protocol == "ssh":
65 cmd.append("-l " + options.user)
66 cmd.append(options.host)
68 elif options.protocol == "srun":
71 cmd.append("-n 1 -N 1 --overlap --mem-per-cpu=0 --cpu-bind=none")
72 cmd.append("--nodelist=" + options.host)
74 elif options.protocol == "pbsdsh":
78 cmd.append(options.host)
80 elif options.protocol == "blaunch":
83 cmd.append("-no-shell")
84 cmd.append(options.host)
88 raise ValueError("Unknown protocol: %s" % options.protocol)
91 if options.appli_mode == "dir":
92 cmd.append(options.appli + "/" + options.remote_script)
95 cmd.append(" WORKINGDIR '%s'" % options.workdir)
97 elif options.appli_mode == "launcher":
98 cmd.append(options.appli + " remote")
100 cmd.append("-m %s -p %s" % (options.nshost, options.nsport))
103 cmd.append("-d " + options.workdir)
106 # elif ignore other appli_mode value