On Fri, Apr 5, 2019 at 4:11 AM Daniel Anechitoaie <[email protected]> wrote:
> What happens when you do a FilePath.readToString() on a Master/Slave setup?
> Will the master read the contents of the file from the salve and process the 
> contents locally?

I am not sure what you mean by “process” in this context. The master
will send a request to the agent to load the file into a string, and
the agent sends back a response with that string.

Reading between the lines a bit, I think you are asking something like
this: suppose the agent workspace contains some possibly big file and
you only need a little bit of information from it. In that case it is
a bad idea to write

FilePath file = workspace.child("all-results.xml");
String xml = file.readtoString(); // slow!
int count = countNumberOfResults(xml);

The better code would be:

FilePath file = workspace.child("all-results.xml");
int count = file.act(new CountNumberOfResults());
// …
private static final class CountNumberOfResults extends
MasterToSlaveFileCallable<Integer> {…}

so that the response on the Remoting channel just contains the one
integer and not the complete file contents.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3qGfkh7B08AHiYCRWkiiu0_6D_d%2BWVGN6n%3DT7Ocrsc%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to