3 class ScriptRemoteParameters:
4 def __init__(self, args):
10 self.protocol = args[0]
11 self.user = self._read_arg(args[1], "NULL")
12 self.host = self._read_arg(args[2], "NULL")
13 self.appli = self._read_arg(args[3], "NULL")
14 self.workdir = self._read_arg(args[4], "NULL")
15 self.ssl = True if args[5] == "1" else False
18 self.remote_script = self._read_arg(args[8], "NULL")
19 self.naming_service = self._read_arg(args[9], "NULL")
20 self.appli_mode = args[10]
23 self.Windows = platform.system() == "Windows"
25 def _read_arg(self, value, null_value):
26 if value == null_value:
32 str.append("protocol: %s" % self.protocol)
33 str.append("user: %s" % self.user)
34 str.append("hostname: %s" % self.host)
35 str.append("appli: %s" % self.appli)
36 str.append("workdir: %s" % self.workdir)
37 str.append("ssl: %s" % self.ssl)
38 str.append("nshost: %s" % self.nshost)
39 str.append("nsport: %s" % self.nsport)
40 str.append("remote_script: %s" % self.remote_script)
41 str.append("naming_service: %s" % self.naming_service)
42 str.append("appil_mode: %s" % self.appli_mode)
46 # ----------------------------------------------
48 options = ScriptRemoteParameters(args)
49 if options.debug: print(options)
51 # build command depending on protocol
53 envd = (options.protocol != "srun")
55 if options.protocol == "rsh":
59 cmd.append("-l " + options.user)
60 cmd.append(options.host)
62 elif options.protocol == "ssh":
66 cmd.append("-l " + options.user)
67 cmd.append(options.host)
69 elif options.protocol == "srun":
72 cmd.append("-n 1 -N 1 -s --mem-per-cpu=0 --cpu-bind=none")
73 cmd.append("--nodelist=" + options.host)
75 elif options.protocol == "pbsdsh":
79 cmd.append(options.host)
81 elif options.protocol == "blaunch":
84 cmd.append("-no-shell")
85 cmd.append(options.host)
89 raise ValueError("Unknown protocol: %s" % options.protocol)
92 if options.appli_mode == "dir":
93 cmd.append(options.appli + "/" + options.remote_script)
95 cmd.append("--noenvd")
97 cmd.append(options.naming_service)
99 cmd.append(options.nshost)
100 cmd.append(options.nsport)
103 cmd.append(" WORKINGDIR '%s'" % options.workdir)
105 elif options.appli_mode == "launcher":
106 cmd.append(options.appli + " remote")
108 cmd.append("-m %s -p %s" % (options.nshost, options.nsport))
111 cmd.append("-d " + options.workdir)
114 # elif ignore other appli_mode value