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

Comparing COMP/CRAB/python/SchedulerSge.py (file contents):
Revision 1.2 by spiga, Wed Jun 11 10:03:07 2008 UTC vs.
Revision 1.11 by spiga, Thu May 6 15:00:21 2010 UTC

# Line 2 | Line 2 | 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
5   import common
6  
7   import os,string
# Line 19 | Line 18 | class SchedulerSge(SchedulerLocal) :
18  
19      def __init__(self):
20          Scheduler.__init__(self,"SGE")
21 <
21 >        self.datasetPath   = None
22 >        self.selectNoInput = None
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'),"_","-")
27  
28 +        try:
29 +            tmp =  cfg_params['CMSSW.datasetpath']
30 +            if tmp.lower() == 'none':
31 +                self.datasetPath = None
32 +                self.selectNoInput = 1
33 +            else:
34 +                self.datasetPath = tmp
35 +                self.selectNoInput = 0
36 +        except KeyError:
37 +            msg = "Error: datasetpath not defined "
38 +            raise CrabException(msg)
39 +
40 +        self.return_data = cfg_params.get('USER.return_data', 0)
41 +        self.copy_data   = cfg_params.get("USER.copy_data", 0)
42 +
43 +        if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
44 +            msg = 'Error: return_data and copy_data cannot be set both to 0\n'
45 +            msg = msg + 'Please modify your crab.cfg file\n'
46 +            raise CrabException(msg)
47 +
48 +        if ( int(self.return_data) == 1 and int(self.copy_data) == 1 ):
49 +            msg = 'Error: return_data and copy_data cannot be set both to 1\n'
50 +            msg = msg + 'Please modify your crab.cfg file\n'
51 +            raise CrabException(msg)
52 +
53 +        if ( int(self.copy_data) == 0 and int(self.publish_data) == 1 ):
54 +            msg = 'Warning: publish_data = 1 must be used with copy_data = 1\n'
55 +            msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
56 +            common.logger.info(msg)
57 +            raise CrabException(msg)
58 +
59 +        if int(self.copy_data) == 1:
60 +            self.SE = cfg_params.get('USER.storage_element', None)
61 +            if not self.SE:
62 +                msg = "Error. The [USER] section has no 'storage_element'"
63 +                common.logger.info(msg)
64 +                raise CrabException(msg)
65 +
66 +            self.proxyValid = 0
67 +            self.dontCheckProxy = int(cfg_params.get("GRID.dont_check_proxy",0))
68 +            self.proxyServer = cfg_params.get("GRID.proxy_server",'myproxy.cern.ch')
69 +            common.logger.debug('Setting myproxy server to ' + self.proxyServer)
70 +
71 +            self.group = cfg_params.get("GRID.group", None)
72 +            self.role  = cfg_params.get("GRID.role", None)
73 +            self.VO    = cfg_params.get('GRID.virtual_organization', 'cms')
74 +
75 +            self.checkProxy()
76 +
77 +        self.role = None
78 +
79 +        self.pool = cfg_params.get('USER.storage_pool',None)
80 + #        self.cpu = cfg_params.get('USER.cpu',172800)
81 + #        self.vmem = cfg_params.get('USER.vmem',2)
82          return
83  
84 +    def envUniqueID(self):
85 +        id = "https://"+common.scheduler.name()+":/${JOB_ID}-"+ \
86 +            string.replace(common._db.queryTask('name'),"_","-")
87 +        return id
88 +
89      def realSchedParams(self,cfg_params):
90          """
91 <        Return dictionary with specific parameters, to use
92 <        with real scheduler  
91 >        Return dictionary with specific parameters, to use
92 >        with real scheduler
93          """
94          params = {}
95          return  params
# Line 48 | Line 105 | class SchedulerSge(SchedulerLocal) :
105              sched_param= ''
106              if (self.queue):
107                  sched_param += '-q '+self.queue +' '
108 <                if (self.res): sched_param += ' -R '+self.res +' '
109 <            pass
108 >            if (self.res): sched_param += '-l '+self.res +' '
109 >
110 >        pass
111 >
112 >        #default is request 2G memory and 48 hours CPU time
113 >        #sched_param += ' -V -l h_vmem=2G -l h_cpu=172800 '
114 > #        sched_param += ' -V -l h_vmem='
115 > #        sched_param += self.vmem.__str__()
116 > #        sched_param += 'G -l h_cpu='
117 > #        sched_param += self.cpu.__str__()
118 > #        sched_param += ' '
119  
54        #request 2G memory and 48 hours CPU time
55        sched_param += ' -l h_vmem=2G -l h_cpu=172800 '
120          return sched_param
121  
122      def loggingInfo(self, id):
# Line 73 | Line 137 | class SchedulerSge(SchedulerLocal) :
137          txt += self.wsExitFunc_common()
138  
139          txt += '    cp ${SGE_STDOUT_PATH} CMSSW_${NJob}.stdout \n'
140 <        txt += '    cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n'        
140 >        txt += '    cp ${SGE_STDERR_PATH} CMSSW_${NJob}.stderr \n'
141          txt += '    tar zcvf ${out_files}.tgz  ${filesToCheck}\n'
142          txt += '    exit $job_exit_code\n'
143          txt += '}\n'
144  
145          return txt
146  
147 +    def listMatch(self, dest, full):
148 +        """
149 +        """
150 +        #if len(dest)!=0:
151 +        sites = [self.blackWhiteListParser.cleanForBlackWhiteList(dest,'list')]
152 +        #else:
153 +        #    sites = [str(getLocalDomain(self))]
154 +        return sites
155 +
156 +    def wsCopyOutput(self):
157 +        txt=self.wsCopyOutput_comm(self.pool)
158 +        return txt
159 +
160 +    def userName(self):
161 +        """ return the user name """
162 +
163 +        ## hack for german naf
164 +        import pwd,getpass
165 +        tmp=pwd.getpwnam(getpass.getuser())[4]
166 +        tmp=tmp.rstrip(',')
167 +        tmp=tmp.rstrip(',')
168 +        tmp=tmp.rstrip(',')
169 +
170 +
171 +        return "/CN="+tmp.strip()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines