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.18 by fanzago, Mon Feb 16 23:24:34 2009 UTC vs.
Revision 1.30 by ewv, Wed Dec 16 17:40:08 2009 UTC

# Line 11 | Line 11 | from crab_exceptions import CrabExceptio
11   import common
12   import os
13   import socket
14 < import sha
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 25 | Line 30 | class SchedulerCondor(SchedulerLocal) :
30          SchedulerLocal.__init__(self,"CONDOR")
31          self.datasetPath   = None
32          self.selectNoInput = None
33 +        self.return_data   = 0
34 +        self.copy_data     = 0
35 +
36          self.environment_unique_identifier = None
37          return
38  
# Line 35 | Line 43 | class SchedulerCondor(SchedulerLocal) :
43          """
44  
45          SchedulerLocal.configure(self, cfg_params)
38        taskHash = sha.new(common._db.queryTask('name')).hexdigest()
39        self.environment_unique_identifier = "https://" + socket.gethostname() + \
40                                              '/' + taskHash + "/${NJob}"
46  
47          try:
48              tmp =  cfg_params['CMSSW.datasetpath']
# Line 53 | Line 58 | class SchedulerCondor(SchedulerLocal) :
58  
59          self.return_data = cfg_params.get('USER.return_data', 0)
60          self.copy_data   = cfg_params.get("USER.copy_data", 0)
56        self.backup_copy = cfg_params.get('USER.backup_copy',0)
57
58        if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
59            msg = 'Error: return_data and copy_data cannot be set both to 0\n'
60            msg = msg + 'Please modify your crab.cfg file\n'
61            raise CrabException(msg)
62
63        if ( int(self.return_data) == 1 and int(self.copy_data) == 1 ):
64            msg = 'Error: return_data and copy_data cannot be set both to 1\n'
65            msg = msg + 'Please modify your crab.cfg file\n'
66            raise CrabException(msg)
61  
62 <        if ( int(self.copy_data) == 0 and int(self.publish_data) == 1 ):
63 <            msg = 'Warning: publish_data = 1 must be used with copy_data = 1\n'
64 <            msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
65 <            common.logger.message(msg)
66 <            raise CrabException(msg)
62 >        self.proxyValid = 0
63 >        self.dontCheckProxy = int(cfg_params.get("GRID.dont_check_proxy", 0))
64 >        self.proxyServer = cfg_params.get("GRID.proxy_server", 'myproxy.cern.ch')
65 >        common.logger.debug('Setting myproxy server to ' + self.proxyServer)
66 >
67 >        self.group = cfg_params.get("GRID.group", None)
68 >        self.role  = cfg_params.get("GRID.role", None)
69 >        self.VO    = cfg_params.get('GRID.virtual_organization', 'cms')
70  
71 <        if ( int(self.copy_data) == 0 and int(self.backup_copy) == 1 ):
75 <            msg = 'Error: copy_data = 0 and backup_data = 1 ==> to use the backup_copy function, the copy_data value has to be = 1\n'
76 <            msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
77 <            raise CrabException(msg)
78 <
79 <        if int(self.copy_data) == 1:
80 <            self.SE = cfg_params.get('USER.storage_element', None)
81 <            if not self.SE:
82 <                msg = "Error. The [USER] section has no 'storage_element'"
83 <                common.logger.message(msg)
84 <                raise CrabException(msg)
85 <                
86 <        if ( int(self.backup_copy) == 1 and int(self.publish_data) == 1 ):
87 <            msg = 'Warning: currently the publication is not supported with the backup copy. Work in progress....\n'
88 <            common.logger.message(msg)
89 <            raise CrabException(msg)
90 <
91 <            self.proxyValid = 0
92 <            self.dontCheckProxy = int(cfg_params.get("EDG.dont_check_proxy",0))
93 <            self.proxyServer = cfg_params.get("EDG.proxy_server",'myproxy.cern.ch')
94 <            common.logger.debug(5,'Setting myproxy server to ' + self.proxyServer)
95 <
96 <            self.group = cfg_params.get("EDG.group", None)
97 <            self.role  = cfg_params.get("EDG.role", None)
98 <            self.VO    = cfg_params.get('EDG.virtual_organization', 'cms')
99 <
100 <            self.checkProxy()
101 <        self.role  = None
71 >        self.checkProxy()
72  
73          return
74  
75 +    def envUniqueID(self):
76 +        taskHash = sha1(common._db.queryTask('name')).hexdigest()
77 +        id = "https://" + socket.gethostname() + '/' + taskHash + "/${NJob}"
78 +        return id
79  
80      def sched_parameter(self, i, task):
81          """
82          Return scheduler-specific parameters
83          """
84 +        req = ''
85 +        if self.EDG_addJdlParam:
86 +            if self.EDG_addJdlParam[-1] == '':
87 +                self.EDG_addJdlParam = self.EDG_addJdlParam[:-1]
88 +            for p in self.EDG_addJdlParam:
89 +                req += p.strip()+';\n'
90  
91 <        index = int(common._db.nJobs()) - 1
112 <        schedParam = ''
113 <
114 <        for i in range(index):
115 <            pass
116 <
117 <        return schedParam
91 >        return req
92  
93  
94      def realSchedParams(self, cfg_params):
# Line 206 | Line 180 | fi
180   """
181  
182          return txt
183 +
184 +
185 +    def sched_fix_parameter(self):
186 +        """
187 +        Returns string with requirements and scheduler-specific parameters
188 +        """
189 +
190 +        if self.EDG_requirements:
191 +            req = self.EDG_requirements
192 +            taskReq = {'commonRequirements':req}
193 +            common._db.updateTask_(taskReq)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines