|
From: Ian H. <ian...@as...> - 2008-07-15 14:13:07
|
Hi Darren, Thanks for helping with this problem. I have investigated further this issue and here is what I have found out: I have traced the errors themselves back to two functions in texmanager.py (matplotlib.texmanager), make_dvi and make_png. Most of the errors seem to mention 'Stale NFS file handles' and crop up at a variety of different places throughout these functions. I guess this is because on our clusters /home/[username] is not a local directory, we have seen issues before with other code if a lot of nodes try to access the same directory on the NFS file system simultaneously. I tried altering the __init__.py to force the code to put the .matplotlib directory on filesystems local to each node. Moving the .matplotlib directory to a local drive solves almost all of these errors. One error that remained was the one about file opening fh = file(outfile) I added a 'w' to this and this seemed to solve this problem, I also commented out some of the verbose generating commands (specifically fh.read() was causing a problem (probably expected with 'w')) within these functions and the errors go away. I guess 'a' would be better but the commands only seem to be called if the file doesn't exist? As we have a lot of users running this code a solution like this is unworkable (as a lot of our users are unfamiliar with python/Linux and want to run a simple command). Do you have any ideas of how we could solve this issue? Thanks again for your help Ian Harry 2008/7/10 Darren Dale <dsd...@gm...>: > On Thursday 10 July 2008 10:48:01 am you wrote: > > Hi Darren, > > > > I have tried rerunning our code with the change you suggested in the > > make_dvi and make_png functions. I am still noticing failures however. I > > put these at the bottom of this message. Strangely enough, these errors > > don't seem to occur when there are a lot of files in my tex.cache > > directory. For example, I ran the code (consisting of ~40 codes all > making > > ~10-20 plots each), successfully 3 times (the OSError wasn't raised at > all, > > I used a print statement to check). I realised after this that a lot of > > temp files were in my tex.cache directory, so I emptied it and then I > > noticed that a lot of failures occured when I ran the code the next time > > (the OSError I showed previously was raised as well as the error messages > > shown below). It seems weird that it should run fine when a lot of files > > are left in my temp directory and not when it is empty? > > Most of those files are not temporary files, but cached files. The error > you > reported only occurs when a required file does not already exist in the > cache, and like you said, it appears to be the case that two jobs are > trying > to add the same file to the cache at the same time, and one job is failing > because the other deletes a temporary file that is being used by both. I > guess. > > > Here are the error messages that are occuring now: > > > > Traceback (most recent call last): > > File > > > "/home/spxiwh/ihope/852450000-852700000/nsbhinj_summary_plots/../executable > >s/plotinspmissed", line 625, in ? > > savePlot( opts, filename, titleText) > > File > > > "/home/spxiwh/ihope/852450000-852700000/nsbhinj_summary_plots/../executable > >s/plotinspmissed", line 108, in savePlot > > dpi_thumb=opts.figure_resolution) > > File > > > "/home/spxiwh/lscsoft/executables/cbc_s5_1yr_20070129/pylal//lib64/python2. > >4/site-packages/pylal/InspiralUtils.py", line 54, in savefig_pylal > > fig.savefig(filename, dpi=dpi) > > File "/home/spxiwh/test/matplotlib/figure.py", line 682, in savefig > > self.canvas.print_figure(*args, **kwargs) > > File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 456, > in > > print_figure > > self.draw() > > File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 392, > in > > draw > > self.figure.draw(renderer) > > File "/home/spxiwh/test/matplotlib/figure.py", line 544, in draw > > for a in self.axes: a.draw(renderer) > > File "/home/spxiwh/test/matplotlib/axes.py", line 1063, in draw > > a.draw(renderer) > > File "/home/spxiwh/test/matplotlib/axis.py", line 595, in draw > > self.label.draw(renderer) > > File "/home/spxiwh/test/matplotlib/text.py", line 340, in draw > > bbox, info = self._get_layout(renderer) > > File "/home/spxiwh/test/matplotlib/text.py", line 187, in _get_layout > > w,h = renderer.get_text_width_height( > > File "/home/spxiwh/test/matplotlib/backends/backend_agg.py", line 240, > in > > get_text_width_height > > Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb) > > File "/home/spxiwh/test/matplotlib/texmanager.py", line 334, in > get_rgba > > pngfile = self.make_png(tex, fontsize, dpi, force=False) > > File "/home/spxiwh/test/matplotlib/texmanager.py", line 255, in > make_png > > fh = file(outfile) > > IOError: [Errno 2] No such file or directory: > > > '/home/spxiwh/.matplotlib/tex.cache/fb2014e54961855bd04020b61190867c.output > >' > > That doesnt make any sense to me. file defaults to open a file in append > mode, > it doesnt matter if a file exists or not. Maybe you could try to figure out > why that fails and report back. > > > And once I noticed: > > > > Traceback (most recent call last): > > File > > > "/home/spxiwh/ihope/852450000-852700000/allinj_summary_plots/../executables > >/plotinspmissed", line 661, in ? > > dpi_thumb=opts.figure_resolution) > > File > > > "/home/spxiwh/lscsoft/executables/cbc_s5_1yr_20070129/pylal//lib64/python2. > >4/site-packages/pylal/InspiralUtils.py", line 54, in savefig_pylal > > fig.savefig(filename, dpi=dpi) > > File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line > 682, > > in savefig > > self.canvas.print_figure(*args, **kwargs) > > File > > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", > > line 456, in print_figure > > self.draw() > > File > > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", > > line 392, in draw > > self.figure.draw(renderer) > > File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line > 544, > > in draw > > for a in self.axes: a.draw(renderer) > > File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line > 1063, > > in draw > > a.draw(renderer) > > File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line 340, > > in draw > > bbox, info = self._get_layout(renderer) > > File "/usr/lib64/python2.4/site-packages/matplotlib/text.py", line 187, > > in _get_layout > > w,h = renderer.get_text_width_height( > > File > > "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", > > line 240, in get_text_width_height > > Z = texmanager.get_rgba(s, size, self.dpi.get(), rgb) > > File "/usr/lib64/python2.4/site-packages/matplotlib/texmanager.py", > line > > 330, in get_rgba > > X = readpng(os.path.join(self.texcache, pngfile)) > > RuntimeError: _image_module::readpng: file not recognized as a PNG file > > No idea, sorry. > > Darren > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- --------------------------------------------------------------------------- Ian Harry School of Physics & Astronomy Queens Buildings, The Parade Cardiff, CF24 3AA Email: Ian...@as... Phone: (+44) 29 208 75120 Mobile: (+44) 7890 479090 --------------------------------------------------------------------------- |