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.15 by ewv, Tue Nov 25 22:24:23 2008 UTC vs.
Revision 1.29 by ewv, Wed Dec 16 17:37:28 2009 UTC

# Line 10 | Line 10 | from crab_exceptions import CrabExceptio
10  
11   import common
12   import os
13 <
13 > import socket
14 > try:
15 >    from hashlib import sha1
16 > except:
17 >    from sha import sha as sha1
18  
19   class SchedulerCondor(SchedulerLocal) :
20      """
# Line 24 | Line 28 | class SchedulerCondor(SchedulerLocal) :
28          SchedulerLocal.__init__(self,"CONDOR")
29          self.datasetPath   = None
30          self.selectNoInput = None
31 +        self.return_data   = 0
32 +        self.copy_data     = 0
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)
37        self.environment_unique_identifier = '${HOSTNAME}_${CONDOR_ID}_' \
38                                             + common._db.queryTask('name')
44  
45          try:
46              tmp =  cfg_params['CMSSW.datasetpath']
# Line 52 | Line 57 | class SchedulerCondor(SchedulerLocal) :
57          self.return_data = cfg_params.get('USER.return_data', 0)
58          self.copy_data   = cfg_params.get("USER.copy_data", 0)
59  
60 <        if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
61 <            msg = 'Error: return_data and copy_data cannot be set both to 0\n'
62 <            msg = msg + 'Please modify your crab.cfg file\n'
63 <            raise CrabException(msg)
64 <
65 <        if ( int(self.return_data) == 1 and int(self.copy_data) == 1 ):
66 <            msg = 'Error: return_data and copy_data cannot be set both to 1\n'
67 <            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')
60 >        self.proxyValid = 0
61 >        self.dontCheckProxy = int(cfg_params.get("GRID.dont_check_proxy", 0))
62 >        self.proxyServer = cfg_params.get("GRID.proxy_server", 'myproxy.cern.ch')
63 >        common.logger.debug('Setting myproxy server to ' + self.proxyServer)
64 >
65 >        self.group = cfg_params.get("GRID.group", None)
66 >        self.role  = cfg_params.get("GRID.role", None)
67 >        self.VO    = cfg_params.get('GRID.virtual_organization', 'cms')
68  
69 <            self.checkProxy()
69 >        self.checkProxy()
70  
71          return
72  
73 +    def envUniqueID(self):
74 +        taskHash = sha1(common._db.queryTask('name')).hexdigest()
75 +        id = "https://" + socket.gethostname() + '/' + taskHash + "/${NJob}"
76 +        return id
77  
78      def sched_parameter(self, i, task):
79          """
80          Return scheduler-specific parameters
81          """
82 +        req = ''
83 +        if self.EDG_addJdlParam:
84 +            if self.EDG_addJdlParam[-1] == '':
85 +                self.EDG_addJdlParam = self.EDG_addJdlParam[:-1]
86 +            for p in self.EDG_addJdlParam:
87 +                req += p.strip()+';\n'
88  
89 <        index = int(common._db.nJobs()) - 1
98 <        schedParam = ''
99 <
100 <        for i in range(index):
101 <            pass
102 <
103 <        return schedParam
89 >        return req
90  
91  
92      def realSchedParams(self, cfg_params):
# Line 121 | Line 107 | class SchedulerCondor(SchedulerLocal) :
107          Check the compatibility of available resources
108          """
109  
110 <        if self.selectNoInput:
125 <            return [True]
126 <        else:
127 <            return SchedulerLocal.listMatch(self, seList, full)
110 >        return [True]
111  
112  
113      def decodeLogInfo(self, fileName):
# Line 195 | Line 178 | fi
178   """
179  
180          return txt
181 +
182 +
183 +    def sched_fix_parameter(self):
184 +        """
185 +        Returns string with requirements and scheduler-specific parameters
186 +        """
187 +
188 +        if self.EDG_requirements:
189 +            req = self.EDG_requirements
190 +            taskReq = {'commonRequirements':req}
191 +            common._db.updateTask_(taskReq)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines