test_loadshed.py

Go to the documentation of this file.
00001 #
00002 #                               Copyright 2005
00003 #                                     by
00004 #                        The Board of Trustees of the
00005 #                     Leland Stanford Junior University.
00006 #                            All rights reserved.
00007 #
00008 
00009 __facility__ = "Online"
00010 __abstract__ = "Test script that issues a loadshed command"
00011 __author__   = "Selim Tuvi <stuvi@slac.stanford.edu> SLAC - GLAST I&T/Online"
00012 __date__     = "2006/04/27 00:00:00"
00013 __updated__  = "$Date: 2006/04/27 22:54:58 $"
00014 __version__  = "$Revision: 1.2 $"
00015 __release__  = "$Name: HEAD $"
00016 __credits__  = "SLAC"
00017 
00018 import LICOS.copyright_SLAC
00019 
00020 import sys
00021 import time
00022 
00023 from LICOS.util.gOptions             import Options
00024 
00025 from LICOS.tools.proxy.VscProxyPorts import VscProxyPorts
00026 from LICOS.scriptEngine.ScriptEngineConnector import ScriptEngineConnector
00027 from LCAT_encoder import LCAT_CmdPacketFactory
00028 
00029 def usage():
00030   return """
00031 
00032 test_loadshed usage:
00033 
00034 Mandatory options:
00035 --vscip    Specify the VSC crate ip address
00036 
00037 Optional options:
00038 --portbase Specify portbase
00039 
00040 Example:
00041 $ test_loadshed --vscip lat-elf21 --portbase 3000
00042 
00043 """
00044 
00045 if __name__ == "__main__":
00046   options = Options(['vscip'],['portbase'])
00047   try:
00048     options.parse()
00049   except Exception, msg:
00050     options.usage(usage())
00051     raise Exception, msg
00052     
00053   if options.portbase is None:
00054     portbase = 3000
00055   else:
00056     portbase = int(options.portbase)
00057   ports = VscProxyPorts(portbase)
00058     
00059   answer = raw_input("Do you really want to perform a loadshed (confirm by entering 'YES')? ")
00060   if answer != "YES":
00061     print "Loadshed aborted."
00062     sys.exit(1)
00063   print "Performing loadshed..."
00064   p = ScriptEngineConnector(options.vscip,None,None)
00065   p.start()
00066   # Issue lookatme in case we are in backdoor mode.
00067   cmd = LCAT_CmdPacketFactory('LIMLOOKATME')
00068   p.execute(cmd)
00069   time.sleep(1)
00070   p.ssr(0)
00071   cmd = LCAT_CmdPacketFactory('LIMLOADSHED')
00072   p.execute(cmd)
00073   print "Loadshed command issued. LAT shutdown expected in 15 seconds."
00074   print "End of run."
00075   sys.exit(0)

Generated on Thu Apr 27 20:52:44 2006 for LICOS L02-01-00 by doxygen 1.4.6-NO