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.9 by fanzago, Tue Jul 15 14:40:10 2008 UTC vs.
Revision 1.16.2.1 by spiga, Tue Apr 13 18:06:33 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','cmscaf')
29 <        self.res = cfg_params.get(self.name().upper()+'.resource','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 <        txt = SchedulerLsf.wsSetupEnvironment(self)
38 <        txt += '# CAF specific stuff\n'
39 <        #txt += 'export STAGE_SVCCLASS=cmscaf \n'
40 <        txt += '\n'
41 <        return txt
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_tmp(self.pool)
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