Skip to content

Commit 480640d

Browse files
authored
Merge pull request #53 from liyancn/master
add example code for limcontrol and mbd restart
2 parents 958de47 + 8cc363b commit 480640d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

examples/limcontrol.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from pythonlsf import lsf
2+
3+
4+
# the hostname you want to operate lim running on
5+
host = "your_hostname"
6+
7+
# set opCode to 1 if you need to reboot lim
8+
#set to 2 if you want to shutdown it
9+
opCode = 1
10+
11+
if lsf.lsb_init("test") > 0:
12+
print("failed to initialize")
13+
exit
14+
if lsf.ls_limcontrol(host, opCode) == 0 :
15+
print("host operated successfully")
16+
else :
17+
print("host operated failed")
18+

examples/restartMbd.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from pythonlsf import lsf
2+
3+
req = lsf.mbdCtrlReq()
4+
req.opCode = 0
5+
req.message = ""
6+
req.name = "mbd"
7+
8+
if lsf.lsb_init("test") > 0 :
9+
print("failed to initialize")
10+
exit
11+
if lsf.lsb_reconfig(req) == 0 :
12+
print("mbd restarted successfully")
13+
else :
14+
print("failed to restart mbd")
15+

0 commit comments

Comments
 (0)