On Jan 15, 2009, at 19:52 , William Stein wrote:

>
> On Thu, Jan 15, 2009 at 7:34 PM, mabshoff
> <[email protected]> wrote:
>>
>>
>>
>> On Jan 15, 7:31 pm, "Justin C. Walker" <[email protected]> wrote:
>>> On Jan 15, 2009, at 19:02 , mabshoff wrote:
>>
>> <SNIP>
>>
>>>> Just use /tmp or DOT_SAGE/tmp, but create a directory in it so you
>>>> don't clobber other jobs of the same kind. It might be a good  
>>>> idea to
>>>> add some create_tmpdir() command in Sage that is guaranteed to be
>>>> unique and is in a writable directory, i.e. it should first try
>>>> DOT_SAGE/tmp, then /tmp and so on. IIRC there is even some env
>>>> variable where we can point a per user tmp dir to. So you might  
>>>> want
>>>> to open a ticket for the above in order to avoid various people  
>>>> doing
>>>> the same thing in their own code over and over again.
>>>
>>> Python has several calls to make temporary files that will not be
>>> clobbered by other users or uses.  No need to make directories.
>>
>> Yes, but we are ending up calling command line tools which to not  
>> obey
>> Python's convention :)
>>
>> And having all the files in one directory makes debugging a lot  
>> easier
>> and it assures that you get rid of all files by just wiping the one
>> tmp directory.
>
> Just to add to this (or subtract, I'm not sure).  Sage doesn't use the
> Python infrastructure for creating temporary directories (say under
> /tmp), since Sage or its subprocesses tend to get brutally kill -9'd a
> lot, etc., and if we used some standard tmp system without care, sage
> would end up leaving a lot of crap around.  Right now, whenever a Sage
> process creates temp directories, it uses the function  tmp_dir()
> which creates the temp directory in
>   $DOT_SAGE/temp/hostname/pid/
> The Sage cleaner, which is a totally different python process from any
> particular Sage you run, will look for processes that have died but
> left around temp files, and it will delete them all (it also kills all
> subprocesses that were left around).  It's finally very good at this,
> though it used to not be.

If the temp files are truly temp files (i.e., not of interest when the  
process that creates them exits), then there are Python calls that  
help: the temp files can be created and unlinked, so that at exit,  
they vanish.  In fact, they are not visible in the file system at all.

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Absorption of Federal Funds
--------
If you're not confused,
You're not paying attention
--------




--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to