-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Docker PSOCK example times out. #7
Comments
@wlandau Thanks for your response! Unfortunately, on my system, the timeout error already occurs while assigning the Regarding sharing files/directories between the host and the container: I haven't worked with Docker much, but if I get the first problem sorted, I'll look into options for how to do this. From a quick search, one should be able to do so using either the One last point: If you should at some point have time to look over my approach to using a packaged |
@wlandau with the help of @HenrikBengtsson my general Docker issue could be resolved (see) I now tried out how one can mount a host's directory in the container to have the Docker
A few comments:
Modification to
One problem/question: When I just run
and afterwards
If you'd like, I can prepare a pull request after implementing your feedback. |
Wow, this is fantastic! Thanks so much @januz! And yes, I would really appreciate a pull request. A few (very minor) comments:
Does this work for you? I will also try on Ubuntu 16.04 when I get a chance later. library(drake)
library(future)
library(stringr)
platform <- "localhost"
if (grepl("(Darwin|Windows)", Sys.info()["sysname"])) {
platform <- "host.docker.internal"
}
cl <- future::makeClusterPSOCK( # nolint
"localhost",
## Launch Rscript inside Docker container
rscript = c(
"docker", "run", "--net=host",
"--mount", paste("type=bind,source=", getwd(), ",target=/home/rstudio", sep = ""),
"rocker/verse",
"Rscript"
),
rscript_args = c(
## Install drake
"-e", shQuote("install.packages('drake')"),
## Install future
"-e", shQuote("install.packages('drake')"),
## set working directory to bound dir
"-e", shQuote("setwd('home/rstudio')")
),
master = platform
)
load_mtcars_example()
# Add a code chunk in `report.Rmd` to verify that
# we are really running it in a Docker container.
write("\n```{r info}\nSys.info()\n```", "report.Rmd", append = TRUE)
make(my_plan, parallelism = "future") |
Also, thanks for switching to an image with more pre-installed packages. |
@wlandau Thanks for your response! I just submitted the PR. What are your thoughts regarding the "problem" I lined out above, with |
Awesome!
I think it is the correct default behavior. That said, you could probably set up a custom trigger to detect the presence of the image and invalidate targets that really should depend on it. docker_sys_info <- function(){
...
}
drake_plan(
...,
report_with_sys.info = target(
command = render(knitr_in("report.Rmd"), ...),
trigger = trigger(change = docker_sys_info())
)
) |
Alright, that makes sense! |
I just retried the Docker PSOCK example on my personal desktop before work this morning, and there seems to be trouble when a target relies on input files or produces output files. @januz, to check if this is really the problem on your end, you might try building everything except the
report
.Either way, we need some way to share files with the Docker container. Ideally, we would make the working directory inside Docker match the working directory of the parent R session. I have not used Docker seriously enough to know how to do this off the top of my head, and I would gladly accept pull requests.
The text was updated successfully, but these errors were encountered: