Commits

Takahiro Tsutsumi authored d7e957a805a
Merged 5.0 fix for the NFS disk issue in automask to master
No tags

gcwrap/python/scripts/imagerhelpers/imager_base.py

Modified
207 207 #stopreasons = ['iteration limit', 'threshold', 'force stop','no change in peak residual across two major cycles']
208 208 stopreasons = ['iteration limit', 'threshold', 'force stop','no change in peak residual across two major cycles', 'peak residual increased by more than 5 times from the previous major cycle','peak residual increased by more than 5 times from the minimum reached','zero mask']
209 209 casalog.post("Reached global stopping criterion : " + stopreasons[stopflag-1], "INFO")
210 210
211 211 # revert the current automask to the previous one
212 212 #if self.iterpars['interactive']:
213 213 for immod in range(0,self.NF):
214 214 if self.alldecpars[str(immod)]['usemask'].count('auto')>0:
215 215 prevmask = self.allimpars[str(immod)]['imagename']+'.prev.mask'
216 216 if os.path.isdir(prevmask):
217 - shutil.rmtree(self.allimpars[str(immod)]['imagename']+'.mask')
218 - #shutil.copytree(prevmask,self.allimpars[str(immod)]['imagename']+'.mask')
219 - shutil.move(prevmask,self.allimpars[str(immod)]['imagename']+'.mask')
217 + # Try to force rmtree even with an error as an nfs mounted disk gives an error
218 + #shutil.rmtree(self.allimpars[str(immod)]['imagename']+'.mask')
219 + shutil.rmtree(self.allimpars[str(immod)]['imagename']+'.mask', ignore_errors=True)
220 + # For NFS mounted disk it still leave .nfs* file(s)
221 + if os.path.isdir(self.allimpars[str(immod)]['imagename']+'.mask'):
222 + import glob
223 + if glob.glob(self.allimpars[str(immod)]['imagename']+'.mask/.nfs*'):
224 + for item in os.listdir(prevmask):
225 + src = os.path.join(prevmask,item)
226 + dst = os.path.join(self.allimpars[str(immod)]['imagename']+'.mask',item)
227 + if os.path.isdir(src):
228 + shutil.move(src, dst)
229 + else:
230 + shutil.copy2(src,dst)
231 + shutil.rmtree(prevmask)
232 + else:
233 + shutil.move(prevmask,self.allimpars[str(immod)]['imagename']+'.mask')
220 234 casalog.post("[" + str(self.allimpars[str(immod)]['imagename']) + "] : Reverting output mask to one that was last used ", "INFO")
221 235
222 236 return (stopflag>0)
223 237
224 238 #############################################
225 239 def updateMask(self):
226 240 # Setup mask for each field ( input mask, and automask )
227 241 maskchanged = False
228 242 for immod in range(0,self.NF):
229 243 maskchanged = maskchanged | self.SDtools[immod].setupmask()

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut