We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9859460 + a392c83 commit 21adf75Copy full SHA for 21adf75
examples/restartRES.py
@@ -0,0 +1,28 @@
1
+import sys,socket
2
+from pythonlsf import lsf
3
+
4
+def restartres(hostlist):
5
+ if lsf.ls_initdebug("resrestart") < 0:
6
+ print("ls_initdebug failed!")
7
+ return -1
8
+ num_port = len(hostlist) * 2
9
+ if lsf.ls_initrex(num_port, 0) < num_port :
10
+ lsf.ls_perror("ls_initrex")
11
12
+ for host in hostlist:
13
+ rc=lsf.ls_rescontrol(host, lsf.RES_CMD_REBOOT, 0)
14
15
+ if rc < 0:
16
+ lsf.ls_perror("lsf.ls_rescontrol")
17
+ print("failed restart res on {}".format(host))
18
+ else :
19
+ print("res on {} restarted".format(host))
20
+ return
21
22
+if __name__ == '__main__':
23
+ if len(sys.argv) > 1 :
24
+ hostlist = sys.argv[1:]
25
26
+ hostlist = [socket.gethostname()]
27
+ restartres(hostlist)
28
0 commit comments