106 |
|
pass |
107 |
|
return supported_protocol |
108 |
|
|
109 |
+ |
### def checkCopy(self, copy_results, list_files): |
110 |
+ |
# """ |
111 |
+ |
# """ |
112 |
+ |
# #results={} |
113 |
+ |
# list_retry = [] |
114 |
+ |
# list_existing = [] |
115 |
+ |
# list_ok = [] |
116 |
+ |
# if copy_results.keys() == '': |
117 |
+ |
# self.results.update(copy_results) |
118 |
+ |
# else: |
119 |
+ |
# for file, dict in copy_results.iteritems(): |
120 |
+ |
# er_code = dict['erCode'] |
121 |
+ |
# if er_code == '0': |
122 |
+ |
# list_ok.append(file) |
123 |
+ |
# reason = 'Copy succedeed with %s utils'%prot |
124 |
+ |
# upDict = self.updateReport(file, er_code, reason) |
125 |
+ |
# copy_results.update(upDict) |
126 |
+ |
# elif er_code == '60303': list_existing.append( file ) |
127 |
+ |
# else: list_retry.append( file ) |
128 |
+ |
# results.update(copy_results) |
129 |
+ |
# if len(list_ok) != 0: |
130 |
+ |
# msg = 'Copy of %s succedeed with %s utils\n'%(str(list_ok),prot) |
131 |
+ |
# if self.debug : print msg |
132 |
+ |
# if len(list_ok) == len(list_files) : |
133 |
+ |
# msg = 'Copy of all files succedeed\n' |
134 |
+ |
# #break |
135 |
+ |
# else: |
136 |
+ |
# if self.debug : print 'Copy of files %s failed using %s...\n'%(str(list_retry)+str(list_existing),prot) |
137 |
+ |
# #if len(list_retry): list_files = list_retry |
138 |
+ |
# return list_retry, results |
139 |
+ |
|
140 |
+ |
|
141 |
|
def stager( self, middleware, list_files ): |
142 |
|
""" |
143 |
|
Implement the logic for remote stage out |
146 |
|
for prot, opt in self.setProtocol( middleware ): |
147 |
|
if self.debug: print 'Trying stage out with %s utils \n'%prot |
148 |
|
copy_results = self.copy( list_files, prot, opt ) |
149 |
+ |
######## to define a new function checkCopy ################ |
150 |
+ |
#list_retry, self.results = self.checkCopy(copy_results, list_files) |
151 |
+ |
|
152 |
+ |
#def checkCopy (self, copy_results): |
153 |
+ |
# """ |
154 |
+ |
# """ |
155 |
+ |
# results={} |
156 |
|
list_retry = [] |
157 |
|
list_existing = [] |
158 |
|
list_ok = [] |
178 |
|
if self.debug : print 'Copy of files %s failed using %s...\n'%(str(list_retry)+str(list_existing),prot) |
179 |
|
if len(list_retry): list_files = list_retry |
180 |
|
else: break |
181 |
+ |
|
182 |
+ |
#if len(list_retry): |
183 |
+ |
# list_files = list_retry |
184 |
+ |
##def backupCopy(list_retry) |
185 |
+ |
# print "in backup" |
186 |
+ |
# self.params['inputFilesList']=list_files |
187 |
+ |
# ### copy backup |
188 |
+ |
# from ProdCommon.FwkJobRep.SiteLocalConfig import loadSiteLocalConfig |
189 |
+ |
# siteCfg = loadSiteLocalConfig() |
190 |
+ |
# #print siteCfg |
191 |
+ |
# seName = siteCfg.localStageOut.get("se-name", None) |
192 |
+ |
# #print "seName = ", seName |
193 |
+ |
# self.params['destination']=seName |
194 |
+ |
# #catalog = siteCfg.localStageOut.get("catalog", None) |
195 |
+ |
# #print "catalog = ", catalog |
196 |
+ |
# implName = siteCfg.localStageOut.get("command", None) |
197 |
+ |
# print "implName = ", implName |
198 |
+ |
# if (implName == 'srm'): |
199 |
+ |
# implName='srmv2' |
200 |
+ |
# self.params['protocol']=implName |
201 |
+ |
# tfc = siteCfg.trivialFileCatalog() |
202 |
+ |
# #print "tfc = ", tfc |
203 |
+ |
# print " self.params['inputFilesList'] = ", self.params['inputFilesList'] |
204 |
+ |
# file_backup=[] |
205 |
+ |
# for input in self.params['inputFilesList']: |
206 |
+ |
# ### to add the correct lfn, passed as argument of cmscp function (--lfn xxxx) |
207 |
+ |
# file = '/store/'+input |
208 |
+ |
# pfn = tfc.matchLFN(tfc.preferredProtocol, file) |
209 |
+ |
# print "pfn = ", pfn |
210 |
+ |
# file_backup.append(pfn) |
211 |
+ |
# self.params['inputFilesList'] = file_backup |
212 |
+ |
# print "#########################################" |
213 |
+ |
# print "self.params['inputFilesList'] = ", self.params['inputFilesList'] |
214 |
+ |
# print "self.params['protocol'] = ", self.params['protocol'] |
215 |
+ |
# print "self.params['option'] = ", self.params['option'] |
216 |
+ |
# self.copy(self.params['inputFilesList'], self.params['protocol'], self.params['option']) |
217 |
+ |
# print "#########################################" |
218 |
+ |
# ###list_retry, self.results = checkCopy(copy_results) |
219 |
+ |
# #check is something fails and created related dict |
220 |
+ |
# # backup = self.analyzeResults(results) |
221 |
+ |
# # if backup : |
222 |
+ |
# # msg = 'WARNING: backup logic is under implementation\n' |
223 |
+ |
# # #backupDict = self.backup() |
224 |
+ |
# # ### NOTE: IT MUST RETURN a DICT contains also LFN and SE Name |
225 |
+ |
# # results.update(backupDict) |
226 |
+ |
# # print msg |
227 |
+ |
|
228 |
|
|
229 |
|
#### TODO Daniele |
230 |
|
#check is something fails and created related dict |