Sometimes ipcluster fails because the controller has not finished creating the FURL files

Bug #358202 reported by Brian Granger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
IPython
Fix Released
Medium
Brian Granger

Bug Description

The reason for this is that the FURL files that the controller write go through buffered IO and it is thus difficult to know when they are really there. But here is a nice solution:

> IO buffering issues are a common problem, the standard solution is:
> - write data to a temporary filename (in the same directory)
> - close the file
> - rename it to the final filename

Thanks! It just occurred to me that this standard pattern can be
nicely encapsulated, for python 2.5, in a context manager perhaps
called 'writefile' that would behave like a normal file object, except
that you do:

with writefile('fiename', mode, etc...) as f:
 f.write(...)
 ...

and the context manager automatically takes care of:

 - making the original file with a temp name
 - closing the temp on exit and doing the rename

all of this transparently.

Related branches

Revision history for this message
Fernando Perez (fdo.perez) wrote :

I'm attaching a slightly documented version of the solution that implements the above pattern, as contributed by Neil Ludban <email address hidden> in the ipvision project. Thanks Neil!

Revision history for this message
Brian Granger (ellisonbg) wrote :

This is pretty subtle because the process that creates the FURL file (ipcontroller) is different from the one that needs it (ipcluster).

Changed in ipython:
assignee: nobody → ellisonbg
importance: Undecided → Medium
status: New → Confirmed
Changed in ipython:
status: Confirmed → Fix Committed
Changed in ipython:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.