From 8cc363b5c7383e951459809d9ac934b26950b4ca Mon Sep 17 00:00:00 2001 From: Yan Li Date: Wed, 7 Jun 2023 10:01:55 +0800 Subject: [PATCH] add example code for limcontrol and mbd restart --- examples/limcontrol.py | 18 ++++++++++++++++++ examples/restartMbd.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 examples/limcontrol.py create mode 100644 examples/restartMbd.py diff --git a/examples/limcontrol.py b/examples/limcontrol.py new file mode 100644 index 0000000..ca5a61e --- /dev/null +++ b/examples/limcontrol.py @@ -0,0 +1,18 @@ +from pythonlsf import lsf + + +# the hostname you want to operate lim running on +host = "your_hostname" + +# set opCode to 1 if you need to reboot lim +#set to 2 if you want to shutdown it +opCode = 1 + +if lsf.lsb_init("test") > 0: + print("failed to initialize") + exit +if lsf.ls_limcontrol(host, opCode) == 0 : + print("host operated successfully") +else : + print("host operated failed") + diff --git a/examples/restartMbd.py b/examples/restartMbd.py new file mode 100644 index 0000000..dc6a29f --- /dev/null +++ b/examples/restartMbd.py @@ -0,0 +1,15 @@ +from pythonlsf import lsf + +req = lsf.mbdCtrlReq() +req.opCode = 0 +req.message = "" +req.name = "mbd" + +if lsf.lsb_init("test") > 0 : + print("failed to initialize") + exit +if lsf.lsb_reconfig(req) == 0 : + print("mbd restarted successfully") +else : + print("failed to restart mbd") +