ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/PostMortemServer.py
Revision: 1.1
Committed: Sun Jun 3 17:52:05 2007 UTC (17 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_0_2, CRAB_2_0_2_pre6, CRAB_2_0_2_pre5, CRAB_2_0_2_pre4, CRAB_2_0_2_pre3, CRAB_1_5_4_SLC3, CRAB_1_5_4_SLC3_pre4, CRAB_2_0_2_pre2, CRAB_2_0_2_pre1, CRAB_1_5_4_SLC3_pre3, CRAB_2_0_1, CRAB_1_5_4_SLC3_pre2, CRAB_2_0_1_pre1, CRAB_1_5_4_SLC3_pre1, CRAB_2_0_0, CRAB_2_0_0_pre10, CRAB_2_0_0_pre9, CRAB_1_5_4, CRAB_1_5_4_pre2, CRAB_1_5_4_pre1, CRAB_2_0_0_pre7, CRAB_2_0_0_pre6, CRAB_1_5_3, CRAB_1_5_3_pre5, CRAB_1_5_3_pre4, CRAB_2_0_0_pre5, CRAB_1_5_3_pre3, configure, CRAB_2_0_0_pre4, CRAB_1_5_3_pre2, CRAB_1_5_3_pre1, CRAB_2_0_0_pre3, CRAB_2_0_0_pre2
Branch point for: CRAB_1_5_4_SLC3_pre4_br, CRAB_1_5_4_SLC3_start
Log Message:
first commit

File Contents

# Content
1 from Actor import *
2 from crab_util import *
3 import common
4 from ApmonIf import ApmonIf
5 import Statistic
6 import time
7 from ProgressBar import ProgressBar
8 from TerminalController import TerminalController
9
10 import xml.dom.minidom
11 import xml.dom.ext
12
13 class PostMortemServer(Actor):
14
15 def __init__(self, cfg_params,):
16 self.cfg_params = cfg_params
17 try:
18 self.server_name = self.cfg_params['CRAB.server_name'] # gsiftp://pcpg01.cern.ch/data/SEDir/
19 except KeyError:
20 msg = 'No server selected ...'
21 msg = msg + 'Please specify a server in the crab cfg file'
22 raise CrabException(msg)
23 return
24
25 def run(self):
26 """
27 The main method of the class: retrieve the post mortem output from server
28 """
29 common.logger.debug(5, "PostMortem server::run() called")
30
31 start = time.time()
32
33 common.scheduler.checkProxy()
34
35 common.taskDB.load()
36 WorkDirName =os.path.basename(os.path.split(common.work_space.topDir())[0])
37 projectUniqName = 'crab_'+str(WorkDirName)+'_'+common.taskDB.dict("TasKUUID")
38 #Need to add a check on the treashold level
39 # and on the task readness TODO
40 try:
41 ### retrieving poject from the server
42 common.logger.message("Retrieving the poject from the server...\n")
43
44 copyHere = common.work_space.jobDir() # MATT
45
46 cmd = 'lcg-cp --vo cms --verbose gsiftp://' + str(self.server_name) + str(projectUniqName)+'/res/failed.tgz file://'+copyHere+'failed.tgz'# MATT
47 common.logger.debug(5, cmd)
48 copyOut = os.system(cmd +' >& /dev/null')
49 except:
50 msg = ("postMortem output not yet available")
51 raise CrabException(msg)
52
53 zipOut = "failed.tgz"
54 if os.path.exists( copyHere + zipOut ): # MATT
55 cwd = os.getcwd()
56 os.chdir( copyHere )# MATT
57 common.logger.debug( 5, 'tar -zxvf ' + zipOut )
58 cmd = 'tar -zxvf ' + zipOut
59 cmd += '; mv .tmpFailed/* .; rm -drf .tmpDone/'
60 cmd_out = runCommand(cmd)
61 os.chdir(cwd)
62 common.logger.debug( 5, 'rm -f '+copyHere+zipOut )# MATT
63 cmd = 'rm -f '+copyHere+zipOut# MATT
64 cmd_out = runCommand(cmd)
65
66 msg='Logging info for project '+str(WorkDirName)+': \n'
67 msg+='written to '+copyHere+' \n' # MATT
68 common.logger.message(msg)
69 else:
70 common.logger.message("Logging info is not yet ready....\n")
71
72 return
73