Skip to content
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

Trouble connecting to google compute engine #141

Open
KendallHoughton opened this issue Jul 3, 2019 · 2 comments
Open

Trouble connecting to google compute engine #141

KendallHoughton opened this issue Jul 3, 2019 · 2 comments
Assignees
Labels

Comments

@KendallHoughton
Copy link

Describe the bug
When connecting to google compute engine, I am able to set up a machine, but am not able to communicate with it.

To Reproduce

library(googleComputeEngineR)
#> Setting scopes to https://www.googleapis.com/auth/cloud-platform
#> Successfully auto-authenticated via /Users/Kendall/Documents/programming/key.json
#> Set default project ID to 'learning-245421'
#> Set default zone to 'us-west1-a'

vm <- 
  gce_vm(
    name = "newvm", ## Name of the VM on GCE,
    predefined_type = "n1-standard-4",
    template = "rstudio", ## Use the rocker/rstudio docker image
    username = "oprah", password = "oprah1234" ## Username and password for RStudio Server login
  )
#> 2019-07-03 14:05:09> Creating template VM
#> 2019-07-03 14:05:11> Operation running...
#> 2019-07-03 14:05:21> Operation running...
#> 2019-07-03 14:05:41> Operation complete in 11 secs
#> 2019-07-03 14:05:42> ## VM Template: 'rstudio' running at http://34.83.114.44
#> 2019-07-03 14:05:42> On first boot, wait a few minutes for docker container to install before logging in.
#> ==Google Compute Engine Instance==
#> 
#> Name:                newvm
#> Created:             2019-07-03 14:05:10
#> Machine Type:        n1-standard-4
#> Status:              RUNNING
#> Zone:                us-west1-a
#> External IP:         34.83.114.44
#> Disks: 
#>        deviceName       type       mode boot autoDelete
#> 1 newvm-boot-disk PERSISTENT READ_WRITE TRUE       TRUE
#> 
#> Metadata:  
#>                      key            value
#> 2               template          rstudio
#> 3 google-logging-enabled             true
#> 4           rstudio_user            oprah
#> 5             rstudio_pw        oprah1234
#> 6      gcer_docker_image rocker/tidyverse
#> 2019-07-03 14:05:42> newvm VM running

gce_vm_stop(vm)
#> 2019-07-03 14:05:42> Request Status Code: 404
#> Error : lexical error: invalid char in json text.
#>                                        Not Found
#>                      (right here) ------^
#> 
#> Not Found
#> Error: lexical error: invalid char in json text.
#>                                        Not Found
#>                      (right here) ------^

Created on 2019-07-03 by the reprex package (v0.2.1)

Expected behavior
I expected to be able to stop the virtual machine from within R studio.

**Session Info

Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] googleComputeEngineR_0.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1        compiler_3.5.3    googleAuthR_0.8.0 prettyunits_1.0.2
 [5] remotes_2.0.4     tools_3.5.3       digest_0.6.19     pkgbuild_1.0.3   
 [9] jsonlite_1.6      memoise_1.1.0     evaluate_0.14     rlang_0.4.0      
[13] reprex_0.2.1      cli_1.1.0         rstudioapi_0.10   curl_3.3         
[17] parallel_3.5.3    xfun_0.8          withr_2.1.2       httr_1.4.0       
[21] knitr_1.23        fs_1.3.1          askpass_1.1       globals_0.12.4   
[25] rprojroot_1.3-2   listenv_0.7.0     R6_2.4.0          processx_3.3.0   
[29] rmarkdown_1.13    whisker_0.3-2     callr_3.2.0       clipr_0.5.0      
[33] magrittr_1.5      backports_1.1.4   codetools_0.2-16  ps_1.3.0         
[37] htmltools_0.3.6   assertthat_0.2.1  future_1.14.0     openssl_1.4      
[41] crayon_1.3.4     

Additional context
Thanks!

@MarkEdmondson1234
Copy link
Collaborator

Thanks for the report - I see that the VM is terminated when I list them via gce_list_instances() but the VM object is a list and it tries to loop through other elements including the name giving the error message. So it does work, but has extra error messages when it also tries to shut down a VM called the timestamp of the VM creation, for example.

You should be able to avoid the error message if you use the string name instead e.g. gce_vm_stop("newvm")

I shall fix this so it only loops through lists of VM objects, not the VM objects themselves!

@KendallHoughton
Copy link
Author

Using the string name works great. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants