Revision: | 1.4 |
Committed: | Fri Jan 4 17:30:56 2008 UTC (17 years, 3 months ago) by slacapra |
Content type: | text/x-python |
Branch: | MAIN |
CVS Tags: | CRAB_2_2_2_pre4, CRAB_2_2_2_pre3, CRAB_2_2_2_pre2, CRAB_2_2_2_pre1, CRAB_2_2_1, CRAB_2_2_1_pre6, CRAB_2_2_1_pre5, CRAB_2_2_1_pre4, PRODCOMMON_0_10_7_testCS2, CRAB_2_2_1_pre3, CRAB_2_2_1_pre2, CRAB_2_2_1_pre1, CRAB_2_2_0, CRAB_2_2_0_pre21, CRAB_2_2_0_pre19, CRAB_2_2_0_pre18, CRAB_2_2_0_pre17, CRAB_2_2_0_pre16, CRAB_2_2_0_pre15, CRAB_2_2_0_pre13, CRAB_2_2_0_pre12, CRAB_2_2_0_pre11, CRAB_2_2_0_pre10, bp_osg_bdii, CRAB_2_2_0_pre9, CRAB_2_2_0_pre8, CRAB_2_2_0_pre7, CRAB_2_1_2, CRAB_2_2_0_pre5, CRAB_2_1_2_pre2, CRAB_2_1_2_pre1, CRAB_2_2_0_pre4, CRAB_2_2_0_pre2, CRAB_2_1_1, CRAB_2_1_1_pre3, CRAB_2_2_0_pre1, CRAB_2_1_1_pre1, CRAB_2_1_0, CRAB_2_1_0_pre6, CRAB_2_1_0_pre5, CRAB_2_1_0_pre4, CRAB_2_1_0_pre3, CRAB_2_1_0_pre2, CRAB_2_1_0_pre1 |
Branch point for: | osg_bdii, CRAB_2_1_2_br, CRAB_2_1_1_pre2 |
Changes since 1.3: | +0 -1 lines |
Log Message: | Add support for LSF/CAF direct submission Re-establish a correct inheritance pattern for Scheruled* classes Start to remove some unneeded try: catch: statement and replace them with appropriate if:then: Erase any use of cfg_param as a common block (expecially in conjuction with apmon) and replace it with the user of task DB Several minor cleanup |
# | Content |
---|---|
1 | from Actor import * |
2 | from crab_util import * |
3 | import common |
4 | from ApmonIf import ApmonIf |
5 | import time |
6 | from ProgressBar import ProgressBar |
7 | from TerminalController import TerminalController |
8 | |
9 | class PostMortemServer(Actor): |
10 | |
11 | def __init__(self, cfg_params,): |
12 | self.cfg_params = cfg_params |
13 | try: |
14 | self.server_name = self.cfg_params['CRAB.server_name'] # gsiftp://pcpg01.cern.ch/data/SEDir/ |
15 | if not self.server_name.endswith("/"): |
16 | self.server_name = self.server_name + "/" |
17 | except KeyError: |
18 | msg = 'No server selected ...' |
19 | msg = msg + 'Please specify a server in the crab cfg file' |
20 | raise CrabException(msg) |
21 | return |
22 | |
23 | def run(self): |
24 | """ |
25 | The main method of the class: retrieve the post mortem output from server |
26 | """ |
27 | common.logger.debug(5, "PostMortem server::run() called") |
28 | |
29 | start = time.time() |
30 | |
31 | common.scheduler.checkProxy() |
32 | |
33 | common.taskDB.load() |
34 | WorkDirName =os.path.basename(os.path.split(common.work_space.topDir())[0]) |
35 | projectUniqName = 'crab_'+str(WorkDirName)+'_'+common.taskDB.dict("TasKUUID") |
36 | #Need to add a check on the treashold level |
37 | # and on the task readness TODO |
38 | try: |
39 | ### retrieving poject from the server |
40 | common.logger.message("Retrieving the poject from the server...\n") |
41 | |
42 | copyHere = common.work_space.jobDir() # MATT |
43 | |
44 | cmd = 'lcg-cp --vo cms --verbose gsiftp://' + str(self.server_name) + str(projectUniqName)+'/res/failed.tgz file://'+copyHere+'failed.tgz'# MATT |
45 | common.logger.debug(5, cmd) |
46 | copyOut = os.system(cmd +' >& /dev/null') |
47 | except: |
48 | msg = ("postMortem output not yet available") |
49 | raise CrabException(msg) |
50 | |
51 | zipOut = "failed.tgz" |
52 | if os.path.exists( copyHere + zipOut ): # MATT |
53 | cwd = os.getcwd() |
54 | os.chdir( copyHere )# MATT |
55 | common.logger.debug( 5, 'tar -zxvf ' + zipOut ) |
56 | cmd = 'tar -zxvf ' + zipOut |
57 | cmd += '; mv .tmpFailed/* .; rm -drf .tmpDone/' |
58 | cmd_out = runCommand(cmd) |
59 | os.chdir(cwd) |
60 | common.logger.debug( 5, 'rm -f '+copyHere+zipOut )# MATT |
61 | cmd = 'rm -f '+copyHere+zipOut# MATT |
62 | cmd_out = runCommand(cmd) |
63 | |
64 | msg='Logging info for project '+str(WorkDirName)+': \n' |
65 | msg+='written to '+copyHere+' \n' # MATT |
66 | common.logger.message(msg) |
67 | else: |
68 | common.logger.message("Logging info is not yet ready....\n") |
69 | |
70 | return |
71 |