RE: hwo to get feedback from remote nodes ?

"Guijarro, Julio" <[email protected]>
Newsgroups gmane.comp.java.smartfrog.devel
Message-ID <8D5B24B83C6A2E4B9E7EE5FA82627DC9600C5A@sdcexcea01.emea.cpqcorp.net>
Hi Sanjay, 

See my answers bellow.

> Scenario:
> I am submitting a description on Node A with sfHost as B. Internally,
on
> Node A the description is parsed and passed to node B over RMI. The
> description on B executes and performs a number of tasks, like
> installing a program.
> Problem 1:
> SF on Node A reports successful deployment after it successfully
> transfers the description to B. If it fails on B, how do I get that
> error on A. 

The deployer use to deploy the description will only report about the
result the deployment. In this case, A will contact with B, deliver the
description and wait until the deployment finishes reporting if it
succeeded or failed.

Then, it is up to the application to report its own messages/errors.

>in this particular case I want the stdout generated by
> install program. This output is available to the sfComponent that is
> performing installation on Node B, but how can I send this data back
to
> parent node using smartfrog?

If you are using runShell, then you can redirect its output to any
component SFDisplay or components that implements any the following
interfaces: 

The attributes that you can use are:
   //outputMsgTo obj;
   // Object that implements org.smartfrog.services.display.PrintMsgInt

   //services.display.SFDisplay uses it

   errorMsgTo  obj;
   // Object that implements
org.smartfrog.services.display.PrintErrMsgIn
   //services.display.SFDisplay uses it

//For stream redirection 
   outputStreamTo   obj;
   // Object that implements
org.smartfrog.services.utils..OutputStreamIntf
   
   //errorStreamTo   obj;     
   // Object that implements org.smartfrog.services.utils..StreamIntf

You can see an example in:
"/org/smartfrog/services/os/runshell/example.sf"

In this example all the runShell components redirect their output to a
SFDisplay component called: CentralOutputDisplay

In your case the display component could be the daemon display deployed
in A or a new display component that you have pre-deployed before your
description or deployed together with your description.



> Problem 2:
> On same lines is it possible to submit a description from on node to
> multiple nodes, in case I want to install same program on multiple
> machines. sfHost doesnt take multiple arguments and command line
syntax
> also takes one machine at a time.


For this you could use different solutions:

A) you could implement a new language function that could take an
attribute (example, array of hosts) and a description and produce an
expanded description that would contain the same description copied
several times, one per element of the array and add to each of them a
new attribute "sfHost elementOfArray;"

B) Write a new component that could take an array and deploy the same
description in all the hosts in this array. I have attached to this
message an example of such component. As an exericise/experiment, you
could use this component together with the mCast components to
automatically build the array of hosts where to deploy your description.

> 
> thanks for the help!
> Sanjay
> 
> 

Regards, 
		Julio G
example.sf (application/octet-stream, 1.9 KB) - not displayed
components.sf (application/octet-stream, 1.8 KB) - not displayed
ArrayCompoundImpl.java (application/octet-stream, 7.7 KB) - not displayed
ArrayCompound.java (application/octet-stream, 1.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.