ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerSge.py
Revision: 1.1
Committed: Mon May 26 13:09:57 2008 UTC (16 years, 11 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
Log Message:
Scheduler interface for SGE, by Hartmut Stadie

File Contents

# User Rev Content
1 slacapra 1.1 from Scheduler import Scheduler
2     from SchedulerLocal import SchedulerLocal
3     from crab_exceptions import *
4     from crab_util import *
5     from crab_logger import Logger
6     import common
7    
8     import os,string
9    
10     #
11     # Naming convention:
12     # methods starting with 'ws' are responsible to provide
13     # corresponding part of the job script ('ws' stands for 'write script').
14     #
15     # Author: Hartmut Stadie <stadie@mail.desy.de> Inst. f. Experimentalphysik; Universitaet Hamburg
16     #
17    
18     class SchedulerSge(SchedulerLocal) :
19    
20     def __init__(self):
21     Scheduler.__init__(self,"SGE")
22    
23     return
24    
25     def configure(self, cfg_params):
26     SchedulerLocal.configure(self, cfg_params)
27     self.environment_unique_identifier = "https://"+common.scheduler.name()+":/${JOB_ID}-"+ \
28     string.replace(common._db.queryTask('name'),"_","-")
29    
30     return
31    
32     def realSchedParams(self,cfg_params):
33     """
34     Return dictionary with specific parameters, to use
35     with real scheduler
36     """
37     params = {}
38     return params
39    
40     def sched_parameter(self,i,task):
41     """
42     Returns parameter scheduler-specific, to use with BOSS .
43     """
44     index = int(common._db.nJobs()) - 1
45     sched_param= ''
46    
47     for i in range(index): # Add loop DS
48     sched_param= ''
49     if (self.queue):
50     sched_param += '-q '+self.queue +' '
51     if (self.res): sched_param += ' -R '+self.res +' '
52     pass
53    
54     #request 2G memory and 48 hours CPU time
55     sched_param += ' -l h_vmem=2G -l h_cpu=172800 '
56     return sched_param
57    
58     def loggingInfo(self, id):
59     """ return logging info about job nj """
60     print "Warning: SchedulerSge::loggingInfo not implemented!"
61     return ""
62    
63     def wsExitFunc(self):
64     """
65     """
66     txt = '\n'
67    
68     txt += '#\n'
69     txt += '# EXECUTE THIS FUNCTION BEFORE EXIT \n'
70     txt += '#\n\n'
71    
72     txt += 'func_exit() { \n'
73     txt += ' if [ $PYTHONPATH ]; then \n'
74     txt += ' update_fjr\n'
75     txt += ' fi\n'
76     txt += ' cd $RUNTIME_AREA \n'
77     txt += ' cp ${SGE_STDOUT_PATH} CMSSW_${NJob}.stdout \n'
78     txt += ' cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n'
79     txt += ' for file in $filesToCheck ; do\n'
80     txt += ' if [ -e $file ]; then\n'
81     txt += ' echo "tarring file $file in $out_files"\n'
82     txt += ' else\n'
83     txt += ' echo "WARNING: output file $file not found!"\n'
84     txt += ' fi\n'
85     txt += ' done\n'
86     txt += ' echo "JOB_EXIT_STATUS = $job_exit_code"\n'
87     txt += ' echo "JobExitCode=$job_exit_code" >> $RUNTIME_AREA/$repo\n'
88     txt += ' dumpStatus $RUNTIME_AREA/$repo\n'
89     txt += ' cp ${SGE_STDOUT_PATH} CMSSW_${NJob}.stdout \n'
90     txt += ' cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n'
91     txt += ' tar zcvf ${out_files}.tgz ${filesToCheck}\n'
92     txt += ' exit $job_exit_code\n'
93     txt += '}\n'
94    
95     return txt
96