Multiple processing compiling the same file

Robert Goldman rpgoldman at sift.info
Wed Jan 31 05:17:32 UTC 2018


Sorry for the late response.

What you have seems like it will work, but couldn't you just as easily 
use the ASDF output translations configuration facility that is 
described here: 
https://common-lisp.net/project/asdf/asdf/Controlling-where-ASDF-saves-compiled-files.html#Controlling-where-ASDF-saves-compiled-files

There's an example there that you could probably adapt by inserting 
`uid` and `pid`, as appropriate.

Best,
r


On 23 Jan 2018, at 6:51, Jim Newton wrote:

> Apparently, this approach seems to work.   I’m not sure if it is the 
> best approach.
> Here is what my code looks like.  It creates a directory in /tmp/ and 
> asdf:load-system
> seems to compile the .fasl files into there.
>
>
> (require :asdf)
> (require :sb-posix)
> (let ((home (directory-namestring (user-homedir-pathname)))
>       (uid (sb-posix:getuid))
>       (pid  (sb-posix:getpid)))
>   (setf asdf::*user-cache* (ensure-directories-exist (format nil 
> "/tmp~A~D/~D/" home uid pid))))
>
> #-quicklisp
> (let ((quicklisp-init
> 	"/lrde/home/jnewton/quicklisp/setup.lisp"))
>   (if (probe-file quicklisp-init)
>       (load quicklisp-init)
>       (error "file not found ~S" quicklisp-init)))
> (asdf:load-system :lisp-types-test)
>
>
>> On 23 Jan 2018, at 12:47, Pascal Bourguignon <pjb at informatimago.com> 
>> wrote:
>>
>>
>>
>>> On 23 Jan 2018, at 12:00, Jim Newton <jnewton at lrde.epita.fr 
>>> <mailto:jnewton at lrde.epita.fr>> wrote:
>>>
>>> If I run several sbcl processes on different nodes in my compute 
>>> cluster, it might happen that two different runs notice the same 
>>> file needs to be recompiled (via asdf),
>>> and they might try to compile it at the same time.  What is the best 
>>> way to prevent this?
>>>
>>> I see in the asdf documentation that there is an asdf:*user-cache* 
>>> variable whose
>>> value is the path name of the directory where asdf compiles into.    
>>> Would it be advisable for my to arrange so that asdf:*user-cache* is 
>>> a function of the pid and hostname and perhaps thread-id (if such a 
>>> thing exists) to avoid such collisions?
>>>
>>> Or is there some better way to handle this which is build into asdf?
>>
>> I had requested that ASDF includes the hostname (or 
>> machine-instance), in the built path for the cache.
>> Unfortunately, for some reason, the maintainers of ASDF thought it 
>> was a good read to remove it.
>> There you are!
>>
>>
>>
>>
>> -- 
>> __Pascal J. Bourguignon__
>>
>>
>>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/asdf-devel/attachments/20180130/68ef73c6/attachment-0001.html>


More information about the asdf-devel mailing list