I'm trying to create an R cluster comprised on VMs on GCE. I've followed the example from googleComputeEngineR. I've pasted the code below.
######
vm_names <- paste0("cpu",1:2)
## specify the cheapest VMs that may get turned off
preemptible = list(preemptible = TRUE)
## start up 2 VMs with R base on them (can also customise via Dockerfiles using gce_vm_template instead)
fiftyvms <- lapply(vm_names, gce_vm, predefined_type = "n1-standard-1",
template = "r-base", scheduling = preemptible)
## add any ssh details, username etc.
fiftyvms <- lapply(fiftyvms, gce_ssh_setup)
## once all launched, add to cluster
plan(cluster, workers = as.cluster(fiftyvms))
Basically, I can create the VMs and establish SSH access to them, but the socketConnection keeps timing out. Any thoughts on what might be wrong?
This is the output I get:
2018-10-10 20:27:20> Creating template VM
2018-10-10 20:27:22> Checking operation...PENDING
2018-10-10 20:27:33> Operation running...
2018-10-10 20:27:53> Operation complete in 17 secs
2018-10-10 20:27:53> External IP for instance cpu1 : 35.240.99.251
2018-10-10 20:27:53> ## VM r-base running at 35.240.99.251
2018-10-10 20:27:53> Wait a few minutes for inital docker container to download and install before logging in.
2018-10-10 20:27:54> VM running
2018-10-10 20:27:59> Creating template VM
2018-10-10 20:28:01> Checking operation...PENDING
2018-10-10 20:28:21> Operation complete in 5 secs
2018-10-10 20:28:22> External IP for instance cpu2 : 35.205.28.126
2018-10-10 20:28:22> ## VM r-base running at 35.205.28.126
2018-10-10 20:28:22> Wait a few minutes for inital docker container to download and install before logging in.
2018-10-10 20:28:23> VM running
## add any ssh details, username etc.
fiftyvms <- lapply(fiftyvms, gce_ssh_setup)
2018-10-10 20:28:30> Public SSH key uploaded to instance
2018-10-10 20:28:38> Public SSH key uploaded to instance
## once all launched, add to cluster
plan(cluster, workers = as.cluster(fiftyvms))
2018-10-10 20:28:59> External IP for instance cpu1 : 35.240.99.251
Error in socketConnection("localhost", port = port, server = TRUE, blocking = TRUE, :
reached elapsed time limit