00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 __facility__ = "Online"
00011 __abstract__ = "Sample application based on seAppBase"
00012 __author__ = "S. Tuvi <stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__ = "2005/07/23 00:08:27"
00014 __updated__ = "$Date: 2006/01/24 19:56:56 $"
00015 __version__ = "$Revision: 1.6 $"
00016 __release__ = "$Name: HEAD $"
00017 __credits__ = "SLAC"
00018
00019 import LICOS.copyright_SLAC
00020
00021 import time
00022 import logging as log
00023
00024 from LICOS.lib.scriptEngine.seAppBase import seAppBase
00025
00026 class testApp(seAppBase):
00027 """!\brief Sample application based on seAppBase.
00028
00029 """
00030 def __init__(self, common, fromVal=None, toVal=None):
00031 """!\brief testApp constructor.
00032
00033 \param fromVal from value
00034 \param toVal to value
00035 """
00036 seAppBase.__init__(self, common)
00037 self.__fromVal = fromVal
00038 self.__toVal = toVal
00039
00040 def setup(self):
00041 """!\brief SETUP transition method.
00042
00043 \return Transition result
00044 """
00045 log.debug("%s setup" % self.getName())
00046
00047 def teardown(self):
00048 """!\brief TEARDOWN transition method.
00049
00050 \return Transition result
00051 """
00052 log.debug("%s teardown" % self.getName())
00053
00054 def startRun(self):
00055 """!\brief START_RUN transition method.
00056
00057 \return Transition result
00058 """
00059 log.debug("%s startRun" % self.getName())
00060 if self.__fromVal is None: self.__fromVal = 0
00061 if self.__toVal is None: self.__toVal = 30
00062
00063 def run(self):
00064 """!\brief RUN transition method.
00065
00066 \return Transition result
00067 """
00068 log.debug("%s run" % self.getName())
00069 for i in xrange(self.__fromVal, self.__toVal):
00070 if self.isStopRequested():
00071 return
00072 time.sleep(.1)
00073 log.info("%d" % i)
00074 self.setCompletionStatus(self.COMPL_STATUS_PASSED)
00075
00076 def stopRun(self):
00077 """!\brief STOP_RUN transition method.
00078
00079 \return Transition result
00080 """
00081 log.debug("%s stopRun" % self.getName())
00082
00083 def pause(self):
00084 """!\brief PAUSE transition method.
00085
00086 \return Transition result
00087 """
00088 log.debug("%s pause" % self.getName())
00089
00090 def resume(self):
00091 """!\brief RESUME transition method.
00092
00093 \return Transition result
00094 """
00095 log.debug("%s resume" % self.getName())
00096
00097 def abort(self):
00098 """!\brief ABORT transition method.
00099
00100 \return Transition result
00101 """
00102 log.debug("%s abort" % self.getName())
00103 self.setCompletionStatus(self.COMPL_STATUS_ABORTED)