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.5 by spiga, Mon Apr 28 22:33:45 2008 UTC vs.
Revision 1.17 by spiga, Tue May 4 17:24:59 2010 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 = cfg_params.get(self.name().upper()+'.queue','dedicated')
29 <        self.res = cfg_params.get(self.name().upper()+'.resource','cmscaf')
30 <    def wsSetupEnvironment(self):
31 <        """
32 <        Returns part of a job script which does scheduler-specific work.
33 <        """
34 <        txt = SchedulerLsf.wsSetupEnvironment(self)
35 <        txt += '# CAF specific stuff\n'
36 <        txt += 'middleware=CAF \n'
37 <        txt += 'export STAGE_SVCCLASS=cmscaf \n'
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 sched_parameter(self,i,task):
34 +        """
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 +
46 + #    def wsSetupEnvironment(self):
47 + #        """
48 + #        Returns part of a job script which does scheduler-specific work.
49 + #        """
50 + #        txt = SchedulerLsf.wsSetupEnvironment(self)
51 + #        txt += '# CAF specific stuff\n'
52 + #        #txt += 'export STAGE_SVCCLASS=cmscaf \n'
53 + #        txt += '\n'
54 + #        return txt
55 +
56 +    def wsCopyOutput(self):
57 +        ### default is the name of the storage pool
58 +        ### where users can copy job outputs  
59 +        txt=self.wsCopyOutput_comm(self.pool)
60          return txt
61  
62 +    def wsExitFunc(self):
63 +        """
64 +        """
65 +        txt = '\n'
66 +
67 +        txt += '#\n'
68 +        txt += '# EXECUTE THIS FUNCTION BEFORE EXIT \n'
69 +        txt += '#\n\n'
70 +        txt += 'func_exit() { \n'
71 +        txt += self.wsExitFunc_common()
72 +
73 +        txt += '    cp *.${LSB_BATCH_JID}.out CMSSW_${NJob}.stdout \n'
74 +        txt += '    cp *.${LSB_BATCH_JID}.err CMSSW_${NJob}.stderr \n'
75 +        txt += '    tar zcvf ${out_files}.tgz  ${filesToCheck}\n'
76 +        txt += '    tmp_size=`ls -gGrta ${out_files}.tgz | awk \'{ print $3 }\'`\n'
77 +        txt += '    rm ${out_files}.tgz\n'
78 +        txt += '    size=`expr $tmp_size`\n'
79 +        txt += '    echo "Total Output dimension: $size"\n'
80 +        txt += '    limit='+str(self.OSBsize) +' \n'
81 +        txt += '    echo "WARNING: output files size limit is set to: $limit"\n'
82 +        txt += '    if [ "$limit" -lt "$size" ]; then\n'
83 +        txt += '        exceed=1\n'
84 +        txt += '        job_exit_code=70000\n'
85 +        txt += '        echo "Output Sanbox too big. Produced output is lost "\n'
86 +        txt += '    else\n'
87 +        txt += '        exceed=0\n'
88 +        txt += '        echo "Total Output dimension $size is fine."\n'
89 +        txt += '    fi\n'
90 +
91 +        txt += '    echo "JOB_EXIT_STATUS = $job_exit_code"\n'
92 +        txt += '    echo "JobExitCode=$job_exit_code" >> $RUNTIME_AREA/$repo\n'
93 +        txt += '    dumpStatus $RUNTIME_AREA/$repo\n'
94 +        txt += '    if [ $exceed -ne 1 ]; then\n'
95 +        txt += '        tar zcvf ${out_files}.tgz  ${final_list}\n'
96 +        txt += '    else\n'
97 +        txt += '        tar zcvf ${out_files}.tgz CMSSW_${NJob}.stdout CMSSW_${NJob}.stderr\n'
98 +        txt += '    fi\n'
99 +        txt += '    python $RUNTIME_AREA/fillCrabFjr.py $RUNTIME_AREA/crab_fjr_$NJob.xml --errorcode $job_exit_code \n'
100 +        txt += '    exit $job_exit_code\n'
101 +        txt += '}\n'
102 +        return txt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines