[Bioc-devel] vignettes using foreach on Windows

Dan Tenenbaum dtenenba at fhcrc.org
Sun Mar 17 02:27:25 CET 2013

On Sat, Mar 16, 2013 at 6:11 PM, Kasper Daniel Hansen
<kasperdanielhansen at gmail.com> wrote:
> Posted here in case other people could benefit.

This is great. Various permutations of this issue have bitten us from
time to time.

> This is solving an issue with writing a vignette using the doParallel
> backend on Windows.
> If you're using foreach on Windows with the doParallel backend, the
> default is to make a socket cluster (since windows don't have fork).
> If you do it on a vignette, the socket cluster will open a number of
> connections (default 3) which will prevent the vignette from being
> build with something that looks like a latex error
> Warning: running command
> '"C:\PROGRA˜2\MIKTEX˜1.9\miktex\bin\texi2dvi.exe" --quiet --pdf
> "bumphunter.tex"  -I
> "E:/biocbld/bbs-2.12-bioc/R/share/texmf/tex/latex" -I
> "E:/biocbld/bbs-2.12-bioc/R/share/texmf/bibtex/bst"' had status 1
> Error in find_vignette_product(name, by = "texi2pdf", engine = engine) :
>   Failed to locate the 'texi2pdf' output file (by engine
> 'utils::Sweave') for vignette with name 'bumphunter'. The following
> files exists in directory '.': 'bumphunter-clusterplot.pdf',
> 'bumphunter-plotSegments.pdf', 'bumphunter.Rnw', 'bumphunter.bib',
> 'bumphunter.tex'
> Calls: <Anonymous> -> find_vignette_product
> At first, it seems like this is solvable by just running
> closeAllConnections() [ Thanks to Henrik Bengstsson ].  Unfortunately,
> when the vignette is being Sweave'd, there is a sink() connection
> open; closing this connection will make R CMD build exit.  The
> solution is to close all socket connects, which you can do with this
> Sweave chunk:
> \section*{Cleanup}
> This is a cleanup step for the vignette on Windows; typically not
> needed for users.
> <<closeConnetions,results=hide>>=

I suppose this could be marked echo=FALSE since the reader of the
vignette doesn't
really need to know that it's happening, but that's a matter of taste,
I suppose.

Thanks for posting this!

> allCon <- showConnections()
> socketCon <- as.integer(rownames(allCon)[allCon[, "class"] == "sockconn"])
> sapply(socketCon, function(ii) close.connection(getConnection(ii)) )
> @
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list