[R] snow parLapply standard output

Martin Morgan mtmorgan at fhcrc.org
Tue Mar 27 16:40:44 CEST 2007


Frank -- Perhaps what you want to do is

summarize <- function(lst) {
    lapply(lst, function(elt) {
        if (elt$status=="ok") elt$value
        else NA
    })
}

summarize(parLapply(tasks, function(elt) {
    # fancy calculation, then
    list(status="ok", value=...)
}))

i.e., return status along with value from the nodes, and
'post-process' the result. Perhaps status is set by capture.output on
the node. Maybe you're hoping to change how later tasks are evaluated
based on results of earlier tasks; but this makes the lapply
sequential rather than parallel.

Martin

"Frank Preiswerk" <frank.preiswerk at stud.unibas.ch> writes:

> I am slightly confused by the way the standard output is redirected in a R
> snow cluster environment.
> I am using parLapply from the snow package to execute a function on my
> MPI/LAM cluster. How can I redirect standard output (produced using "cat")
> from this function back to the terminal where I invoked it? I intend to
> transmit some status information in advance to the final result of the
> function. I investigated the chain of functions called by parLapply and it
> seems that snow is designed to just retrieve the final result of the
> computation.
>
> Thanks in advance for any hints,
> Frank Preiswerk
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org



More information about the R-help mailing list