1

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

CChen
  • 23
  • 6
  • Are you getting the same error with a non-preemtible VM instance. Can you try following steps in this document [Running R at Scale on Compute Engine](https://cloud.google.com/solutions/running-r-at-scale). A similar question was also answered in this [community post](https://stackoverflow.com/questions/19248598/cant-open-sockets-for-parallel-cluster). You can also try shutting down and restarting the R session. – Sunny J Oct 12 '18 at 11:53
  • 1
    Thanks @SunnyJ. I will give the debug in the other post a try. I've tried to implement the other document on Compute Engine since yesterday. Unfortunately, there is a similar issue where I cannot get the compute workers to communicate with the frontend. – CChen Oct 12 '18 at 13:21
  • Okay, great. If you are unable to debug as per the [post](https://stackoverflow.com/questions/19248598/cant-open-sockets-for-parallel-cluster) you can always share what the similar issue is from the GCE documentation referencing the step where you are getting stuck. – Sunny J Oct 12 '18 at 16:59

0 Answers0