ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerCaf.py
(Generate patch)

Comparing COMP/CRAB/python/SchedulerCaf.py (file contents):
Revision 1.2 by slacapra, Mon Jan 7 18:20:20 2008 UTC vs.
Revision 1.18 by fanzago, Thu Jul 14 16:33:29 2011 UTC

# Line 1 | Line 1
1   from Scheduler import Scheduler
2   from SchedulerLsf import SchedulerLsf
3   from crab_exceptions import *
4 from crab_logger import Logger
4   import common
5  
6   import os,string
# Line 17 | Line 16 | class SchedulerCaf(SchedulerLsf) :
16      def __init__(self):
17          SchedulerLsf.__init__(self)
18          Scheduler.__init__(self,"CAF")
19 +        self.OSBsize = 55000000
20  
21          return
22  
# Line 25 | Line 25 | class SchedulerCaf(SchedulerLsf) :
25          CAF is just a special queue and resources for LSF at CERN
26          """
27          SchedulerLsf.configure(self, cfg_params)
28 <        self.queue = 'dedicated'
29 <        self.res = 'cmscaf'
28 >        self.queue = cfg_params.get(self.name().upper()+'.queue','cmscaf1nw')
29 >        self.res = cfg_params.get(self.name().upper()+'.resource','"type==SLC5_64 || type==SLC4_64"')
30 >        self.group = cfg_params.get(self.name().upper()+'.group', None)
31 >        self.pool = cfg_params.get('USER.storage_pool','cmscafuser')
32  
33 <    def wsSetupEnvironment(self):
33 >    def sched_parameter(self,i,task):
34          """
35 <        Returns part of a job script which does scheduler-specific work.
35 >        Returns parameter scheduler-specific, to use with BOSS .
36          """
37 +        sched_param= ''
38 +
39 +        if (self.queue):
40 +            sched_param += '-q '+self.queue +' '
41 +        if (self.res): sched_param += ' -R '+self.res +' '
42 +        if (self.group): sched_param += ' -G '+str(self.group).upper() +' '
43 +        return sched_param
44 +
45 +    ###### FEDE FOR 84387 bug ######
46 +    def wsSetupEnvironment(self):
47 +        #Returns part of a job script which does scheduler-specific work.
48          txt = SchedulerLsf.wsSetupEnvironment(self)
49          txt += '# CAF specific stuff\n'
50 <        txt += 'middleware=CAF \n'
51 <        txt += 'export STAGE_SVCCLASS=cmscaf \n'
50 >        txt += 'echo "----- ENV CAF BEFORE sourcing /afs/cern.ch/cms/caf/setup.sh  -----"\n'
51 >        txt += 'echo "CMS_PATH = $CMS_PATH"\n'
52 >        txt += 'echo "STAGE_SVCCLASS = $STAGE_SVCCLASS"\n'
53 >        txt += 'echo "STAGER_TRACE = $STAGER_TRACE"\n'
54 >        txt += 'source /afs/cern.ch/cms/caf/setup.sh \n'
55 >        txt += '\n'
56 >        txt += 'echo "----- ENV CAF AFTER sourcing /afs/cern.ch/cms/caf/setup.sh  -----"\n'
57 >        txt += 'echo "CMS_PATH = $CMS_PATH"\n'
58 >        txt += 'echo "STAGE_SVCCLASS = $STAGE_SVCCLASS"\n'
59 >        txt += 'echo "STAGER_TRACE = $STAGER_TRACE"\n'
60 >        txt += '\n'
61 >        return txt
62 >    #############################
63  
64 +    def wsCopyOutput(self):
65 +        ### default is the name of the storage pool
66 +        ### where users can copy job outputs  
67 +        txt=self.wsCopyOutput_comm(self.pool)
68          return txt
69  
70 +    def wsExitFunc(self):
71 +        """
72 +        """
73 +        txt = '\n'
74 +
75 +        txt += '#\n'
76 +        txt += '# EXECUTE THIS FUNCTION BEFORE EXIT \n'
77 +        txt += '#\n\n'
78 +        txt += 'func_exit() { \n'
79 +        txt += self.wsExitFunc_common()
80 +
81 +        txt += '    cp *.${LSB_BATCH_JID}.out CMSSW_${NJob}.stdout \n'
82 +        txt += '    cp *.${LSB_BATCH_JID}.err CMSSW_${NJob}.stderr \n'
83 +        txt += '    tar zcvf ${out_files}.tgz  ${filesToCheck}\n'
84 +        txt += '    tmp_size=`ls -gGrta ${out_files}.tgz | awk \'{ print $3 }\'`\n'
85 +        txt += '    rm ${out_files}.tgz\n'
86 +        txt += '    size=`expr $tmp_size`\n'
87 +        txt += '    echo "Total Output dimension: $size"\n'
88 +        txt += '    limit='+str(self.OSBsize) +' \n'
89 +        txt += '    echo "WARNING: output files size limit is set to: $limit"\n'
90 +        txt += '    if [ "$limit" -lt "$size" ]; then\n'
91 +        txt += '        exceed=1\n'
92 +        txt += '        job_exit_code=70000\n'
93 +        txt += '        echo "Output Sanbox too big. Produced output is lost "\n'
94 +        txt += '    else\n'
95 +        txt += '        exceed=0\n'
96 +        txt += '        echo "Total Output dimension $size is fine."\n'
97 +        txt += '    fi\n'
98 +
99 +        txt += '    echo "JOB_EXIT_STATUS = $job_exit_code"\n'
100 +        txt += '    echo "JobExitCode=$job_exit_code" >> $RUNTIME_AREA/$repo\n'
101 +        txt += '    dumpStatus $RUNTIME_AREA/$repo\n'
102 +        txt += '    if [ $exceed -ne 1 ]; then\n'
103 +        txt += '        tar zcvf ${out_files}.tgz  ${final_list}\n'
104 +        txt += '    else\n'
105 +        txt += '        tar zcvf ${out_files}.tgz CMSSW_${NJob}.stdout CMSSW_${NJob}.stderr\n'
106 +        txt += '    fi\n'
107 +        txt += '    python $RUNTIME_AREA/fillCrabFjr.py $RUNTIME_AREA/crab_fjr_$NJob.xml --errorcode $job_exit_code \n'
108 +        txt += '    exit $job_exit_code\n'
109 +        txt += '}\n'
110 +        return txt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines