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.13 by ewv, Tue Sep 30 19:35:34 2008 UTC vs.
Revision 1.28 by spiga, Sat Dec 12 16:35:39 2009 UTC

# Line 10 | Line 10 | from crab_exceptions import CrabExceptio
10  
11   import common
12   import os
13 <
14 < # Naming convention:  Methods starting with 'ws' provide the corresponding part of the job script
15 < # ('ws' stands for 'write script').
13 > import socket
14 > from crab_util import hashlib_wrap
15  
16   class SchedulerCondor(SchedulerLocal) :
17      """
18      Class to implement the vanilla (local) Condor scheduler
19 +     Naming convention:  Methods starting with 'ws' provide
20 +     the corresponding part of the job script
21 +     ('ws' stands for 'write script').
22      """
23  
24      def __init__(self):
25          SchedulerLocal.__init__(self,"CONDOR")
26          self.datasetPath   = None
27          self.selectNoInput = None
28 +        self.return_data   = 0
29 +        self.copy_data     = 0
30 +
31          self.environment_unique_identifier = None
32          return
33  
# Line 33 | Line 38 | class SchedulerCondor(SchedulerLocal) :
38          """
39  
40          SchedulerLocal.configure(self, cfg_params)
36        self.environment_unique_identifier ='${HOSTNAME}_${CONDOR_ID}_' + common._db.queryTask('name')
41  
42          try:
43              tmp =  cfg_params['CMSSW.datasetpath']
# Line 47 | Line 51 | class SchedulerCondor(SchedulerLocal) :
51              msg = "Error: datasetpath not defined "
52              raise CrabException(msg)
53  
54 +        self.return_data = cfg_params.get('USER.return_data', 0)
55 +        self.copy_data   = cfg_params.get("USER.copy_data", 0)
56 +
57 +        self.proxyValid = 0
58 +        self.dontCheckProxy = int(cfg_params.get("GRID.dont_check_proxy", 0))
59 +        self.proxyServer = cfg_params.get("GRID.proxy_server", 'myproxy.cern.ch')
60 +        common.logger.debug('Setting myproxy server to ' + self.proxyServer)
61 +
62 +        self.group = cfg_params.get("GRID.group", None)
63 +        self.role  = cfg_params.get("GRID.role", None)
64 +        self.VO    = cfg_params.get('GRID.virtual_organization', 'cms')
65 +
66 +        self.checkProxy()
67 +
68          return
69  
70 +    def envUniqueID(self):
71 +        taskHash = hashlib_wrap(common._db.queryTask('name'))
72 +        id = "https://" + socket.gethostname() + '/' + taskHash + "/${NJob}"
73 +        return id
74  
75      def sched_parameter(self, i, task):
76          """
77          Return scheduler-specific parameters
78          """
79 +        req = ''
80 +        if self.EDG_addJdlParam:
81 +            if self.EDG_addJdlParam[-1] == '':
82 +                self.EDG_addJdlParam = self.EDG_addJdlParam[:-1]
83 +            for p in self.EDG_addJdlParam:
84 +                req += p.strip()+';\n'
85  
86 <        index = int(common._db.nJobs()) - 1
59 <        schedParam = ''
60 <
61 <        for i in range(index):
62 <            pass
63 <
64 <        return schedParam
86 >        return req
87  
88  
89      def realSchedParams(self, cfg_params):
# Line 82 | Line 104 | class SchedulerCondor(SchedulerLocal) :
104          Check the compatibility of available resources
105          """
106  
107 <        if self.selectNoInput:
86 <            return [True]
87 <        else:
88 <            return SchedulerLocal.listMatch(self, seList, full)
107 >        return [True]
108  
109  
110      def decodeLogInfo(self, fileName):
# Line 99 | Line 118 | class SchedulerCondor(SchedulerLocal) :
118          return reason
119  
120  
121 +    def wsCopyOutput(self):
122 +        """
123 +        Write a CopyResults part of a job script, e.g.
124 +        to copy produced output into a storage element.
125 +        """
126 +        txt = self.wsCopyOutput_comm()
127 +        return txt
128 +
129 +
130      def wsExitFunc(self):
131          """
132          Returns the part of the job script which runs prior to exit
# Line 131 | Line 159 | class SchedulerCondor(SchedulerLocal) :
159          txt += 'printenv | sort\n'
160  
161          txt += 'middleware='+self.name()+' \n'
162 +        txt += 'if [ -e /opt/d-cache/srm/bin ]; then\n'
163 +        txt += '  export PATH=${PATH}:/opt/d-cache/srm/bin\n'
164 +        txt += 'fi\n'
165 +
166          txt += """
167   if [ $_CONDOR_SCRATCH_DIR ] && [ -d $_CONDOR_SCRATCH_DIR ]; then
168      echo "cd to Condor scratch directory: $_CONDOR_SCRATCH_DIR"
# Line 143 | Line 175 | fi
175   """
176  
177          return txt
178 +
179 +
180 +    def sched_fix_parameter(self):
181 +        """
182 +        Returns string with requirements and scheduler-specific parameters
183 +        """
184 +
185 +        if self.EDG_requirements:
186 +            req = self.EDG_requirements
187 +            taskReq = {'commonRequirements':req}
188 +            common._db.updateTask_(taskReq)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines