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

Comparing COMP/CRAB/python/SchedulerCondor.py (file contents):
Revision 1.16 by ewv, Mon Jan 26 19:43:48 2009 UTC vs.
Revision 1.32 by ewv, Mon Jun 28 18:50:38 2010 UTC

# Line 10 | Line 10 | from crab_exceptions import CrabExceptio
10  
11   import common
12   import os
13 + import socket
14  
15 + # FUTURE: for python 2.4 & 2.6
16 + try:
17 +    from hashlib import sha1
18 + except:
19 +    from sha import sha as sha1
20  
21   class SchedulerCondor(SchedulerLocal) :
22      """
# Line 24 | Line 30 | class SchedulerCondor(SchedulerLocal) :
30          SchedulerLocal.__init__(self,"CONDOR")
31          self.datasetPath   = None
32          self.selectNoInput = None
33 +
34          self.environment_unique_identifier = None
35          return
36  
# Line 34 | Line 41 | class SchedulerCondor(SchedulerLocal) :
41          """
42  
43          SchedulerLocal.configure(self, cfg_params)
44 <        self.environment_unique_identifier = '${HOSTNAME}_${CONDOR_ID}_' \
45 <                                             + common._db.queryTask('name')
44 >
45 >        self.proxyValid=0
46 >        self.dontCheckProxy=int(cfg_params.get("GRID.dont_check_proxy",0))
47 >        self.space_token = cfg_params.get("USER.space_token",None)
48 >        try:
49 >            self.proxyServer = Downloader("http://cmsdoc.cern.ch/cms/LCG/crab/config/").config("myproxy_server.conf")
50 >            self.proxyServer = self.proxyServer.strip()
51 >            if self.proxyServer is None:
52 >                raise CrabException("myproxy_server.conf retrieved but empty")
53 >        except Exception, e:
54 >            common.logger.info("Problem setting myproxy server endpoint: using myproxy.cern.ch")
55 >            common.logger.debug(e)
56 >            self.proxyServer= 'myproxy.cern.ch'
57 >        self.group = cfg_params.get("GRID.group", None)
58 >        self.role = cfg_params.get("GRID.role", None)
59 >        self.VO = cfg_params.get('GRID.virtual_organization','cms')
60  
61          try:
62              tmp =  cfg_params['CMSSW.datasetpath']
# Line 49 | Line 70 | class SchedulerCondor(SchedulerLocal) :
70              msg = "Error: datasetpath not defined "
71              raise CrabException(msg)
72  
73 <        self.return_data = cfg_params.get('USER.return_data', 0)
53 <        self.copy_data   = cfg_params.get("USER.copy_data", 0)
54 <
55 <        if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
56 <            msg = 'Error: return_data and copy_data cannot be set both to 0\n'
57 <            msg = msg + 'Please modify your crab.cfg file\n'
58 <            raise CrabException(msg)
59 <
60 <        if ( int(self.return_data) == 1 and int(self.copy_data) == 1 ):
61 <            msg = 'Error: return_data and copy_data cannot be set both to 1\n'
62 <            msg = msg + 'Please modify your crab.cfg file\n'
63 <            raise CrabException(msg)
64 <
65 <        if ( int(self.copy_data) == 0 and int(self.publish_data) == 1 ):
66 <            msg = 'Warning: publish_data = 1 must be used with copy_data = 1\n'
67 <            msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
68 <            common.logger.message(msg)
69 <            raise CrabException(msg)
70 <
71 <        if int(self.copy_data) == 1:
72 <            self.SE = cfg_params.get('USER.storage_element', None)
73 <            if not self.SE:
74 <                msg = "Error. The [USER] section has no 'storage_element'"
75 <                common.logger.message(msg)
76 <                raise CrabException(msg)
77 <
78 <            self.proxyValid = 0
79 <            self.dontCheckProxy = int(cfg_params.get("EDG.dont_check_proxy",0))
80 <            self.proxyServer = cfg_params.get("EDG.proxy_server",'myproxy.cern.ch')
81 <            common.logger.debug(5,'Setting myproxy server to ' + self.proxyServer)
82 <
83 <            self.group = cfg_params.get("EDG.group", None)
84 <            self.role  = cfg_params.get("EDG.role", None)
85 <            self.VO    = cfg_params.get('EDG.virtual_organization', 'cms')
86 <
87 <            self.checkProxy()
88 <        self.role  = None
73 >        self.checkProxy()
74  
75          return
76  
77 +    def envUniqueID(self):
78 +        taskHash = sha1(common._db.queryTask('name')).hexdigest()
79 +        id = "https://" + socket.gethostname() + '/' + taskHash + "/${NJob}"
80 +        return id
81  
82      def sched_parameter(self, i, task):
83          """
84          Return scheduler-specific parameters
85          """
86 +        req = ''
87 +        if self.EDG_addJdlParam:
88 +            if self.EDG_addJdlParam[-1] == '':
89 +                self.EDG_addJdlParam = self.EDG_addJdlParam[:-1]
90 +            for p in self.EDG_addJdlParam:
91 +                req += p.strip()+';\n'
92  
93 <        index = int(common._db.nJobs()) - 1
99 <        schedParam = ''
100 <
101 <        for i in range(index):
102 <            pass
103 <
104 <        return schedParam
93 >        return req
94  
95  
96      def realSchedParams(self, cfg_params):
# Line 193 | Line 182 | fi
182   """
183  
184          return txt
185 +
186 +
187 +    def sched_fix_parameter(self):
188 +        """
189 +        Returns string with requirements and scheduler-specific parameters
190 +        """
191 +
192 +        if self.EDG_requirements:
193 +            req = self.EDG_requirements
194 +            taskReq = {'commonRequirements':req}
195 +            common._db.updateTask_(taskReq)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines