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

Comparing COMP/CRAB/python/SchedulerGlite.py (file contents):
Revision 1.37 by fanzago, Tue Mar 4 11:09:13 2008 UTC vs.
Revision 1.45 by ewv, Thu Apr 10 13:13:59 2008 UTC

# Line 13 | Line 13 | class SchedulerGlite(SchedulerGrid):
13  
14      def configure(self,cfg_params):
15          SchedulerGrid.configure(self, cfg_params)
16 +        self.checkProxy()
17          self.environment_unique_identifier = 'GLITE_WMS_JOBID'
18  
19      def rb_configure(self, RB):
# Line 24 | Line 25 | class SchedulerGlite(SchedulerGrid):
25          glite_config = gliteConfig.config()
26  
27          if (glite_config ):
28 <            rb_param_file = 'WMSconfig = '+glite_config+';\n'
28 >            rb_param_file = glite_config
29          return rb_param_file
30  
31      def ce_list(self):
32          """
33 <        Returns string with requirement CE related    
33 >        Returns string with requirement CE related
34          """
35 <        req = ''  
35 >        req = ''
36          if self.EDG_ce_white_list:
37              ce_white_list = self.EDG_ce_white_list
38              tmpCe=[]
# Line 62 | Line 63 | class SchedulerGlite(SchedulerGrid):
63          # requirement added to skip gliteCE
64          req += '&& (!RegExp("blah", other.GlueCEUniqueId))'
65  
66 <        return req
66 >        return req,self.EDG_ce_white_list,self.EDG_ce_black_list
67  
68 <    def se_list(self, id):
68 >    def se_list(self, id, dest):
69          """
70 <        Returns string with requirement SE related    
71 <        """  
72 <        hostList=self.findSites_(id)
70 >        Returns string with requirement SE related
71 >        """
72 >        hostList=self.findSites_(id,dest)
73          req=''
74          reqtmp=[]
75          concString = '||'
# Line 82 | Line 83 | class SchedulerGlite(SchedulerGrid):
83  
84      def jdlParam(self):
85          """
86 <        Returns
87 <        """
86 >        Returns
87 >        """
88          req=''
89          if self.EDG_addJdlParam:
90 <            if self.EDG_addJdlParam[-1] == '': self.EDG_addJdlParam= self.EDG_addJdlParam[:-1]
90 >            if self.EDG_addJdlParam[-1] == '': self.EDG_addJdlParam= self.EDG_addJdlParam[:-1]
91              for p in self.EDG_addJdlParam:
92               #   param_file.write(string.strip(p)+';\n')
93                  req+=string.strip(p)+';\n' ## BL--DS
# Line 95 | Line 96 | class SchedulerGlite(SchedulerGrid):
96      def specific_req(self):
97          """
98          Returns string with specific requirements
99 <        """
99 >        """
100          req=''
101          if self.EDG_clock_time:
102              if (not req == ' '): req = req + ' && '
# Line 104 | Line 105 | class SchedulerGlite(SchedulerGrid):
105          if self.EDG_cpu_time:
106              if (not req == ' '): req = req + ' && '
107              req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
108 <        
108 >
109          return req
110  
111 <    def sched_parameter(self):
111 >    def sched_fix_parameter(self):
112          """
113          Returns string with requirements and scheduler-specific parameters
114          """
115 <        index = int(common._db.nJobs()) - 1
116 <        job = common.job_list[index]
115 >        index = int(common._db.nJobs())
116 >        job = common.job_list[index-1]
117          jbt = job.type()
117
118      ### To Be Removed BL--DS
119      #  lastDest=''
120      #  first = []
121      #  last  = []
122      #  for n in range(common.jobDB.nJobs()):
123      #      currDest=common.jobDB.destination(n)
124      #      if (currDest!=lastDest):
125      #          lastDest = currDest
126      #          first.append(n)
127      #          if n != 0:last.append(n-1)
128      #  if len(first)>len(last) :last.append(common.jobDB.nJobs())
129
118          req = ''
119          req = req + jbt.getRequirements()
120  
121          if self.EDG_requirements:
122              if (not req == ' '): req = req +  ' && '
123              req = req + self.EDG_requirements
124 +
125 +        Task_Req={'jobType':req}## DS--BL
126 +        common._db.updateTask_(Task_Req)
127 +
128 +    def sched_parameter(self,i,task):
129 +        """
130 +        Returns string with requirements and scheduler-specific parameters
131 +        """
132 +        dest=  eval(task.jobs[i-1]['dlsDestination']) ## DS--BL
133 +
134 +        req=''
135 +        req +=task['jobType']
136 +
137          sched_param=''
138 <        sched_param='""pippo""'
138 >        sched_param+='Requirements = ' + req +self.specific_req() + self.se_list(i,dest) +\
139 >                                        self.ce_list()[0] +';\n' ## BL--DS
140 >        if self.EDG_addJdlParam: sched_param+=self.jdlParam() ## BL--DS
141 >        sched_param+='MyProxyServer = "' + self.proxyServer + '";\n'
142 >        sched_param+='VirtualOrganisation = "' + self.VO + '";\n'
143 >        sched_param+='RetryCount = '+str(self.EDG_retry_count)+';\n'
144 >        sched_param+='ShallowRetryCount = '+str(self.EDG_shallow_retry_count)+';\n'
145  
146 <        ### Temporary Problem with quote and py2sqlite.... under investigation..        
140 <        for i in range(index):
141 <           # sched_param+='Requirements = ' + req +self.specific_req() + self.se_list(i) +\
142 <           #                                 self.ce_list() +';\n' ## BL--DS
143 <           # if self.EDG_addJdlParam: sched_param+=self.jdlParam() ## BL--DS
144 <           # if (self.rb_param_file): sched_param+=self.rb_param_file ## BL--DS
145 <           # print sched_param
146 <            run_jobReq={'schedulerAttributes':sched_param}## DS--BL
147 <            common._db.updateRunJob_(i,run_jobReq)        
146 >        return sched_param
147  
148      def wsSetupEnvironment(self):
149          """
150          Returns part of a job script which does scheduler-specific work.
151          """
152 <        txt = ''
154 <        txt += '# strip arguments\n'
155 <        txt += 'echo "strip arguments"\n'
156 <        txt += 'args=("$@")\n'
157 <        txt += 'nargs=$#\n'
158 <        txt += 'shift $nargs\n'
159 <        txt += "# job number (first parameter for job wrapper)\n"
160 <        txt += "NJob=${args[0]}; export NJob\n"
161 <
162 <        txt += '# job identification to DashBoard \n'
163 <        #txt += 'MonitorJobID=`echo ${NJob}_$GLITE_WMS_JOBID`\n'
164 <        #txt += 'SyncGridJobId=`echo $GLITE_WMS_JOBID`\n'
165 <        #txt += 'MonitorID=`echo ' + self._taskId + '`\n'
166 <        txt += 'MonitorJobID=${NJob}_$GLITE_WMS_JOBID \n'
167 <        txt += 'SyncGridJobId=$GLITE_WMS_JOBID \n'
168 <        txt += 'MonitorID='+self._taskId+' \n'
169 <        txt += 'echo "MonitorJobID=$MonitorJobID" > $RUNTIME_AREA/$repo \n'
170 <        txt += 'echo "SyncGridJobId=$SyncGridJobId" >> $RUNTIME_AREA/$repo \n'
171 <        txt += 'echo "MonitorID=$MonitorID" >> $RUNTIME_AREA/$repo\n'
172 <        #txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
173 <        #txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
174 <        #txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
175 <
176 <        #txt += 'echo "middleware discovery: " \n'
177 <        txt += 'echo ">>> GridFlavour discovery: " \n'
178 <        txt += 'if [ $VO_CMS_SW_DIR ]; then \n'
179 <        txt += '    middleware=LCG\n'
180 <        #txt += '    echo "SyncCE=`glite-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n'
181 <        txt += '    echo "SyncCE=`glite-brokerinfo getCE`" >> $RUNTIME_AREA/$repo \n'
182 <        #txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
183 <        txt += '    echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n'
184 <        #txt += '    echo ">>> middleware =$middleware" \n'
185 <        txt += 'elif [ $OSG_APP ]; then \n'
186 <        txt += '    middleware=OSG \n'
187 <        txt += '    if [ $OSG_JOB_CONTACT ]; then \n'
188 <        txt += '        SyncCE="$OSG_JOB_CONTACT"; \n'
189 <        #txt += '        echo "SyncCE=$SyncCE" | tee -a $RUNTIME_AREA/$repo ;\n'
190 <        txt += '        echo "SyncCE=$SyncCE" >> $RUNTIME_AREA/$repo ;\n'
191 <        txt += '    else\n'
192 <        txt += '        echo "not reporting SyncCE";\n'
193 <        txt += '    fi\n';
194 <        txt += '    echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n'
195 <        #txt += '    echo ">>> middleware =$middleware" \n'
196 <        txt += 'else \n'
197 <        txt += '    echo "ERROR ==> GridFlavour not identified" \n'
198 <        txt += '    job_exit_code=10030\n'
199 <        txt += '    func_exit \n'
200 <        #txt += '    echo "SET_CMS_ENV 10030 ==> middleware not identified" \n'
201 <        #txt += '    echo "JOB_EXIT_STATUS = 10030" \n'
202 <        #txt += '    echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n'
203 <        #txt += '    dumpStatus $RUNTIME_AREA/$repo \n'
204 <        #txt += '    exit 1 \n'
205 <        txt += 'fi \n'
206 <
207 <        txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
208 <
209 <        txt += '\n\n'
152 >        txt = SchedulerGrid.wsSetupEnvironment(self)
153  
154          txt += 'export VO='+self.VO+'\n'
155          txt += 'if [ $middleware == LCG ]; then\n'
# Line 220 | Line 163 | class SchedulerGlite(SchedulerGrid):
163          txt += '    else \n'
164          txt += '        echo "ERROR ==> OSG mode in setting CE name from OSG_JOB_CONTACT" \n'
165          txt += '        job_exit_code=10099\n'
166 <        txt += '        func_exit \n'
224 <        #txt += '        echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n'
225 <        #txt += '        echo "JOB_EXIT_STATUS = 10099" \n'
226 <        #txt += '        echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n'
227 <        #txt += '        dumpStatus $RUNTIME_AREA/$repo \n'
228 <        #txt += '        exit 1 \n'
166 >        txt += '        func_exit\n'
167          txt += '    fi \n'
168          txt += 'fi \n'
169  
# Line 246 | Line 184 | class SchedulerGlite(SchedulerGrid):
184          cmd_out = runCommand(cmd)
185          return cmd_out
186  
187 +    def findSites_(self, n, sites):
188 +        itr4 =[]
189 +        if len(sites)>0 and sites[0]=="":
190 +            return itr4
191 +        if sites != [""]:
192 +            ##Addedd Daniele
193 +            replicas = self.blackWhiteListParser.checkBlackList(sites,n)
194 +            if len(replicas)!=0:
195 +                replicas = self.blackWhiteListParser.checkWhiteList(replicas,n)
196 +
197 +            itr4 = replicas
198 +            #####
199 +        return itr4
200 +
201 +
202 +
203  
204      def tOut(self, list):
205          return 180

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines