Of course curtail is }:   - sorry about that.

Ronan


On 18/11/2006 23:47, "Ronan Reilly" <[EMAIL PROTECTED]> wrote:

> Just a little further clarification on the host/ip issue.
> 
> I'm using the very useful simple socket client-server framework to run an
> evolutionary algorithm written in J on an 80 node unix cluster.  The clients
> evolve separate populations, the server propagates the current fittest
> member across all the clients.  The tricky bit is that I have to launch the
> server as a batch job, so I don't know ahead of time on what node it will
> run.  I then launch the clients who each open a socket to the server.
> However, the clients have to know the location of the server (so
> sdgethostbyname won't work).
> 
> The solution that works for me is to get the server to execute:
> host =: {: 2!:0 hostname
> and write the result to a file along with the port number etc., which is
> then read by clients when they launch.
> 
> Note that echo $HOSTNAME doesn't work because it seems to pick up the value
> from the launching environment (this might also be true if you use getenv).
> Also, the curtail ({:) is crucial.  The socket opening routine is
> unforgiving of the CR that hostname appends to the result (the jconsole
> crashes with a broken-pipe error).
> 
> Thanks for all the useful feedback, and thanks to Eric Iverson for the
> excellent client/server lab and code template.
> 
> Ronan
> 
> 
> On 17/11/2006 08:22, "Ronan Reilly" <[EMAIL PROTECTED]> wrote:
> 
>> Thanks Joey!  I'd been looking in the wrong place.
>> 
>> Ronan
>> 
>> 
>> On 16/11/2006 21:24, "Joey K Tuttle" <[EMAIL PROTECTED]> wrote:
>> 
>>> At 19:20  +0000 2006/11/16, Ronan Reilly wrote:
>>>> Hi All,
>>>> 
>>>> I'm running a distributed application on a cluster using J and I need a
>>>> verb
>>>> that returns the IP (or hostname) of the node on which the jconsole is
>>>> running. 
>>>> 
>>>> Thanks for any help.
>>>> 
>>> 
>>> Assuming you are in a _NIX environment, 2!:0 (Host) is
>>> the key - e.g. I would use:
>>> 
>>>      host 'echo $HOSTNAME'
>>> focus
>>> 
>>> 
>>> where host is defined as:
>>> 
>>>     host
>>> [: 2!:0 '('"_ , ] , ' || true)'"_
>>> 
>>> 
>>> You might choose to make a simpler verb with just 2!:0
>>> but the extra stuff in the above definition makes it
>>> more useful in that it always returns a result, even if
>>> the expression passed to the host has no result.
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>> 
>> 
>> --
>> Professor Ronan Reilly
>> Head of Department
>> Department of Computer Science
>> NUI Maynooth
>> Maynooth
>> Co. Kildare
>> IRELAND
>> 
>> t: +353-1-7083847
>> e: [EMAIL PROTECTED]
>> w: http://www.cs.nuim.ie; http://cortex.cs.nuim.ie
>> 
>> 
>> 
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> 
> 
> --
> Professor Ronan Reilly
> Head of Department
> Department of Computer Science
> NUI Maynooth
> Maynooth
> Co. Kildare
> IRELAND
> 
> t: +353-1-7083847
> e: [EMAIL PROTECTED]
> w: http://www.cs.nuim.ie; http://cortex.cs.nuim.ie
> 
> 
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 

--
Professor Ronan Reilly
Head of Department
Department of Computer Science
NUI Maynooth
Maynooth
Co. Kildare
IRELAND

t: +353-1-7083847
e: [EMAIL PROTECTED]
w: http://www.cs.nuim.ie; http://cortex.cs.nuim.ie



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to