From c1ebae6d0bc77a3b3dc8baac973e3d678e2b2564 Mon Sep 17 00:00:00 2001 From: Mark Edmondson Date: Sat, 1 Feb 2020 18:13:37 +0100 Subject: [PATCH] support subnetworks #154 --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 1 + R/networks.R | 26 +++++++++---- R/vms.R | 17 ++++----- man/AttachedDisk.Rd | 20 +++++++--- man/Disk.Rd | 16 ++++++-- man/Instance.Rd | 19 +++++++--- man/Metadata.Rd | 3 +- man/as.cluster.gce_instance.Rd | 11 ++++-- man/docker_build.Rd | 10 ++++- man/docker_cmd.Rd | 10 ++++- man/docker_cmd.gce_instance.Rd | 11 +++++- man/docker_run.Rd | 12 +++++- man/gce_attach_disk.Rd | 24 +++++++++--- man/gce_check_gpu.Rd | 5 ++- man/gce_delete_disk.Rd | 7 +++- man/gce_delete_firewall_rule.Rd | 9 +++-- man/gce_get_disk.Rd | 7 +++- man/gce_get_firewall_rule.Rd | 9 +++-- man/gce_get_instance.Rd | 7 +++- man/gce_get_machinetype.Rd | 7 +++- man/gce_list_disks.Rd | 9 ++++- man/gce_list_disks_all.Rd | 8 +++- man/gce_list_firewall_rules.Rd | 17 ++++++--- man/gce_list_gpus.Rd | 14 +++++-- man/gce_list_images.Rd | 8 +++- man/gce_list_instances.Rd | 10 +++-- man/gce_list_machinetype.Rd | 10 +++-- man/gce_list_machinetype_all.Rd | 8 +++- man/gce_list_networks.Rd | 8 +++- man/gce_list_zone_op.Rd | 9 ++++- man/gce_list_zones.Rd | 3 +- man/gce_make_boot_disk.Rd | 10 +++-- man/gce_make_disk.Rd | 19 +++++++--- man/gce_make_firewall_rule.Rd | 19 +++++++--- man/gce_make_firewall_webports.Rd | 9 +++-- man/gce_make_machinetype_url.Rd | 8 +++- man/gce_make_network.Rd | 21 +++++++---- man/gce_pull_registry.Rd | 15 ++++++-- man/gce_push_registry.Rd | 17 ++++++--- man/gce_rstudio_adduser.Rd | 9 ++++- man/gce_schedule_docker.Rd | 10 +++-- man/gce_set_machinetype.Rd | 10 ++++- man/gce_set_metadata.Rd | 11 ++++-- man/gce_ssh.Rd | 51 +++++++++++++++++++------- man/gce_ssh_addkeys.Rd | 17 ++++++--- man/gce_ssh_browser.Rd | 6 ++- man/gce_ssh_setup.Rd | 17 ++++++--- man/gce_tag_container.Rd | 12 ++++-- man/gce_vm.Rd | 61 ++++++++++++++++--------------- man/gce_vm_cluster.Rd | 12 ++++-- man/gce_vm_container.Rd | 10 ++++- man/gce_vm_create.Rd | 35 +++++++++++++----- man/gce_vm_delete.Rd | 7 +++- man/gce_vm_deletion_protection.Rd | 34 +++++++++++++++-- man/gce_vm_gpu.Rd | 5 ++- man/gce_vm_reset.Rd | 7 +++- man/gce_vm_scheduler.Rd | 18 +++++---- man/gce_vm_start.Rd | 7 +++- man/gce_vm_stop.Rd | 7 +++- man/gce_vm_template.Rd | 30 +++++++++------ man/googleComputeEngineR.Rd | 1 - man/makeDockerClusterPSOCK.Rd | 10 ++++- vignettes/massive-parallel.html | 9 ++--- 65 files changed, 594 insertions(+), 258 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5a974bf..87dbf3e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,4 +34,4 @@ Suggests: License: MIT + file LICENSE LazyData: true VignetteBuilder: knitr -RoxygenNote: 6.1.1 +RoxygenNote: 7.0.2 diff --git a/NAMESPACE b/NAMESPACE index b73a479..19d4b6b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -68,6 +68,7 @@ export(gce_make_firewall_rule) export(gce_make_firewall_webports) export(gce_make_image_source_url) export(gce_make_machinetype_url) +export(gce_make_network) export(gce_metadata_env) export(gce_pull_registry) export(gce_push_registry) diff --git a/NEWS.md b/NEWS.md index f0ba920..daf4a8f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ * Fix being able to restart cluster VMs (#149) * Remove `gce_list_registry` as its not working * Add `gce_vm_deletion_protection` to help add or remove deletion protection for VMs +* Support subnetworks (#154) and expose making your own networks via `gce_make_network` # 0.3.0 diff --git a/R/networks.R b/R/networks.R index b59a0fd..78713e8 100644 --- a/R/networks.R +++ b/R/networks.R @@ -28,14 +28,17 @@ gce_get_external_ip <- function(instance, #' @param network Name of network resource #' @param externalIP An external IP you have created previously, leave NULL to have one assigned or "none" for none #' @param project Project ID for this request +#' @param subnetwork A subnetwork name if its exists #' #' You need to provide accessConfig explicitly if you want an ephemeral IP assigned, see \code{https://cloud.google.com/compute/docs/vm-ip-addresses} #' #' @return A Network object -#' @keywords internal -gce_make_network <- function(name, - network = "default", +#' @export +gce_make_network <- function(network = "default", + name = NULL, + subnetwork = NULL, externalIP = NULL, + reservedIp = NULL, project = gce_get_global_project()){ make_ac <- function(externalIP, name){ @@ -44,8 +47,7 @@ gce_make_network <- function(name, list( list( natIP = jsonlite::unbox(externalIP), - type = jsonlite::unbox("ONE_TO_ONE_NAT"), - name = jsonlite::unbox(name) + type = jsonlite::unbox("ONE_TO_ONE_NAT") ) ) } @@ -54,16 +56,22 @@ gce_make_network <- function(name, structure( list( - list( + rmNullObs(list( network = jsonlite::unbox(net$selfLink), + subnetwork = jsonlite::unbox(subnetwork), + name = name, accessConfigs = make_ac(externalIP, name) - ) + )) ), class = c("gce_networkInterface", "list") ) } +is.gce_networkInterface <- function(x){ + inherits(x, "gce_networkInterface") +} + #' Returns the specified network. #' #' @@ -122,7 +130,9 @@ gce_list_networks <- function(filter = NULL, pageToken = pageToken) pars <- rmNullObs(pars) - f <- gar_api_generator(url, "GET", pars_args = pars, data_parse_function = function(x) x) + f <- gar_api_generator(url, "GET", + pars_args = pars, + data_parse_function = function(x) x$items) f() } \ No newline at end of file diff --git a/R/vms.R b/R/vms.R index 0113094..a4cc7aa 100644 --- a/R/vms.R +++ b/R/vms.R @@ -223,7 +223,7 @@ gce_vm_delete_one <- function(instance, #' @param image Name of the image resource to return #' @param image_family Name of the image family to search for #' @param disk_source Specifies a valid URL to an existing Persistent Disk resource. -#' @param network The name of the network interface +#' @param network A network object created by \link{gce_make_network} #' @param externalIP An external IP you have previously reserved, leave NULL to have one assigned or \code{"none"} for no external access. #' @param minCpuPlatform Specify a minimum CPU platform as per \href{these Google docs}{https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform} #' @param project Project ID for this request @@ -243,12 +243,12 @@ gce_vm_delete_one <- function(instance, gce_vm_create <- function(name, predefined_type = "f1-micro", image_project = "debian-cloud", - image_family = "debian-8", + image_family = "debian-9", cpus = NULL, memory = NULL, image = "", disk_source = NULL, - network = "default", + network = gce_make_network("default"), externalIP = NULL, canIpForward = NULL, description = NULL, @@ -266,7 +266,8 @@ gce_vm_create <- function(name, acceleratorType = "nvidia-tesla-p4") { assert_that( - is.string(name) + is.string(name), + is.gce_networkInterface(network) ) ## missing only works within function its called from @@ -323,7 +324,8 @@ gce_vm_create <- function(name, if(nchar(image_family) > 0){ ## creation from image_family - source_image_url <- gce_make_image_source_url(image_project, family = image_family) + source_image_url <- gce_make_image_source_url(image_project, + family = image_family) } else { ## creation from image stopifnot(nchar(image) > 0) @@ -367,10 +369,7 @@ gce_vm_create <- function(name, zone = zone) ## make network interface - networkInterfaces <- gce_make_network(name = paste0(name, "-ip"), - network = network, - externalIP = externalIP, - project = project) + networkInterfaces <- network ## make serviceAccounts if(is.null(serviceAccounts)){ diff --git a/man/AttachedDisk.Rd b/man/AttachedDisk.Rd index a7803a9..172dacc 100644 --- a/man/AttachedDisk.Rd +++ b/man/AttachedDisk.Rd @@ -4,10 +4,19 @@ \alias{AttachedDisk} \title{AttachedDisk Object} \usage{ -AttachedDisk(autoDelete = NULL, boot = NULL, deviceName = NULL, - diskEncryptionKey = NULL, index = NULL, initializeParams = NULL, - interface = NULL, licenses = NULL, mode = NULL, source = NULL, - type = NULL) +AttachedDisk( + autoDelete = NULL, + boot = NULL, + deviceName = NULL, + diskEncryptionKey = NULL, + index = NULL, + initializeParams = NULL, + interface = NULL, + licenses = NULL, + mode = NULL, + source = NULL, + type = NULL +) } \arguments{ \item{autoDelete}{Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance)} @@ -42,7 +51,8 @@ AttachedDisk Object An instance-attached disk resource. } \seealso{ -Other AttachedDisk functions: \code{\link{gce_attach_disk}} +Other AttachedDisk functions: +\code{\link{gce_attach_disk}()} } \concept{AttachedDisk functions} \keyword{internal} diff --git a/man/Disk.Rd b/man/Disk.Rd index 4715bda..e7c0d72 100644 --- a/man/Disk.Rd +++ b/man/Disk.Rd @@ -4,10 +4,18 @@ \alias{Disk} \title{Disk Object} \usage{ -Disk(name = NULL, sourceImage = NULL, sizeGb = NULL, - description = NULL, diskEncryptionKey = NULL, licenses = NULL, - sourceImageEncryptionKey = NULL, sourceSnapshot = NULL, - sourceSnapshotEncryptionKey = NULL, type = NULL) +Disk( + name = NULL, + sourceImage = NULL, + sizeGb = NULL, + description = NULL, + diskEncryptionKey = NULL, + licenses = NULL, + sourceImageEncryptionKey = NULL, + sourceSnapshot = NULL, + sourceSnapshotEncryptionKey = NULL, + type = NULL +) } \arguments{ \item{name}{Name of the resource} diff --git a/man/Instance.Rd b/man/Instance.Rd index 585fb79..abeb05a 100644 --- a/man/Instance.Rd +++ b/man/Instance.Rd @@ -4,11 +4,20 @@ \alias{Instance} \title{Instance Object} \usage{ -Instance(name = NULL, machineType = NULL, canIpForward = NULL, - description = NULL, disks = NULL, metadata = NULL, - networkInterfaces = NULL, scheduling = NULL, - serviceAccounts = NULL, tags = NULL, minCpuPlatform = NULL, - guestAccelerators = NULL) +Instance( + name = NULL, + machineType = NULL, + canIpForward = NULL, + description = NULL, + disks = NULL, + metadata = NULL, + networkInterfaces = NULL, + scheduling = NULL, + serviceAccounts = NULL, + tags = NULL, + minCpuPlatform = NULL, + guestAccelerators = NULL +) } \arguments{ \item{name}{The name of the resource, provided by the client when initially creating the resource} diff --git a/man/Metadata.Rd b/man/Metadata.Rd index cb37605..236d42c 100644 --- a/man/Metadata.Rd +++ b/man/Metadata.Rd @@ -16,7 +16,8 @@ Metadata object Metadata Object } \seealso{ -Other Metadata functions: \code{\link{gce_set_metadata}} +Other Metadata functions: +\code{\link{gce_set_metadata}()} } \concept{Metadata functions} \keyword{internal} diff --git a/man/as.cluster.gce_instance.Rd b/man/as.cluster.gce_instance.Rd index 9eb3f9a..b51b57c 100644 --- a/man/as.cluster.gce_instance.Rd +++ b/man/as.cluster.gce_instance.Rd @@ -4,9 +4,14 @@ \alias{as.cluster.gce_instance} \title{Create a future cluster for GCE objects} \usage{ -\method{as.cluster}{gce_instance}(x, project = gce_get_global_project(), - zone = gce_get_global_zone(), rshopts = ssh_options(x), ..., - recursive = FALSE) +\method{as.cluster}{gce_instance}( + x, + project = gce_get_global_project(), + zone = gce_get_global_zone(), + rshopts = ssh_options(x), + ..., + recursive = FALSE +) } \arguments{ \item{x}{The instance to make a future cluster} diff --git a/man/docker_build.Rd b/man/docker_build.Rd index 86ee5d8..8f994dc 100644 --- a/man/docker_build.Rd +++ b/man/docker_build.Rd @@ -4,8 +4,14 @@ \alias{docker_build} \title{Build image on an instance from a local Dockerfile} \usage{ -docker_build(host = localhost, dockerfolder, new_image, - folder = "buildimage", wait = FALSE, ...) +docker_build( + host = localhost, + dockerfolder, + new_image, + folder = "buildimage", + wait = FALSE, + ... +) } \arguments{ \item{host}{A host object.} diff --git a/man/docker_cmd.Rd b/man/docker_cmd.Rd index a1eecb2..ed5d47e 100644 --- a/man/docker_cmd.Rd +++ b/man/docker_cmd.Rd @@ -4,8 +4,14 @@ \alias{docker_cmd} \title{Run a docker command on a host.} \usage{ -docker_cmd(host, cmd = NULL, args = NULL, docker_opts = NULL, - capture_text = FALSE, ...) +docker_cmd( + host, + cmd = NULL, + args = NULL, + docker_opts = NULL, + capture_text = FALSE, + ... +) } \arguments{ \item{host}{A host object.} diff --git a/man/docker_cmd.gce_instance.Rd b/man/docker_cmd.gce_instance.Rd index 5b27b80..396d34d 100644 --- a/man/docker_cmd.gce_instance.Rd +++ b/man/docker_cmd.gce_instance.Rd @@ -4,8 +4,15 @@ \alias{docker_cmd.gce_instance} \title{Docker S3 method for use with harbor package} \usage{ -\method{docker_cmd}{gce_instance}(host, cmd = NULL, args = NULL, - docker_opts = NULL, capture_text = FALSE, nvidia = FALSE, ...) +\method{docker_cmd}{gce_instance}( + host, + cmd = NULL, + args = NULL, + docker_opts = NULL, + capture_text = FALSE, + nvidia = FALSE, + ... +) } \arguments{ \item{host}{The GCE instance} diff --git a/man/docker_run.Rd b/man/docker_run.Rd index d1be568..508128e 100644 --- a/man/docker_run.Rd +++ b/man/docker_run.Rd @@ -4,8 +4,16 @@ \alias{docker_run} \title{Run a command in a new container on a host.} \usage{ -docker_run(host = localhost, image = NULL, cmd = NULL, name = NULL, - rm = FALSE, detach = FALSE, docker_opts = NULL, ...) +docker_run( + host = localhost, + image = NULL, + cmd = NULL, + name = NULL, + rm = FALSE, + detach = FALSE, + docker_opts = NULL, + ... +) } \arguments{ \item{host}{An object representing the host where the container will be run.} diff --git a/man/gce_attach_disk.Rd b/man/gce_attach_disk.Rd index 1a76229..f03132a 100644 --- a/man/gce_attach_disk.Rd +++ b/man/gce_attach_disk.Rd @@ -4,11 +4,22 @@ \alias{gce_attach_disk} \title{Attaches a Disk resource to an instance.} \usage{ -gce_attach_disk(instance, source = NULL, autoDelete = NULL, - boot = NULL, deviceName = NULL, diskEncryptionKey = NULL, - index = NULL, initializeParams = NULL, interface = NULL, - licenses = NULL, mode = NULL, type = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_attach_disk( + instance, + source = NULL, + autoDelete = NULL, + boot = NULL, + deviceName = NULL, + diskEncryptionKey = NULL, + index = NULL, + initializeParams = NULL, + interface = NULL, + licenses = NULL, + mode = NULL, + type = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instance}{The instance name for this request} @@ -52,6 +63,7 @@ Authentication scopes used by this function are: \seealso{ \href{https://cloud.google.com/compute/docs/reference/latest/disks}{Google Documentation} -Other AttachedDisk functions: \code{\link{AttachedDisk}} +Other AttachedDisk functions: +\code{\link{AttachedDisk}()} } \concept{AttachedDisk functions} diff --git a/man/gce_check_gpu.Rd b/man/gce_check_gpu.Rd index 6208891..d990a7c 100644 --- a/man/gce_check_gpu.Rd +++ b/man/gce_check_gpu.Rd @@ -18,7 +18,8 @@ Check GPU installed ok \seealso{ \url{https://cloud.google.com/compute/docs/gpus/add-gpus#verify-driver-install} -Other GPU instances: \code{\link{gce_list_gpus}}, - \code{\link{gce_vm_gpu}} +Other GPU instances: +\code{\link{gce_list_gpus}()}, +\code{\link{gce_vm_gpu}()} } \concept{GPU instances} diff --git a/man/gce_delete_disk.Rd b/man/gce_delete_disk.Rd index b69c52b..c9b7653 100644 --- a/man/gce_delete_disk.Rd +++ b/man/gce_delete_disk.Rd @@ -4,8 +4,11 @@ \alias{gce_delete_disk} \title{Deletes the specified persistent disk.} \usage{ -gce_delete_disk(disk, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_delete_disk( + disk, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{disk}{Name of the persistent disk to delete} diff --git a/man/gce_delete_firewall_rule.Rd b/man/gce_delete_firewall_rule.Rd index 5463252..76287fb 100644 --- a/man/gce_delete_firewall_rule.Rd +++ b/man/gce_delete_firewall_rule.Rd @@ -17,9 +17,10 @@ Deletes a firewall rule of name specified \seealso{ API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/delete} -Other firewall functions: \code{\link{gce_get_firewall_rule}}, - \code{\link{gce_list_firewall_rules}}, - \code{\link{gce_make_firewall_rule}}, - \code{\link{gce_make_firewall_webports}} +Other firewall functions: +\code{\link{gce_get_firewall_rule}()}, +\code{\link{gce_list_firewall_rules}()}, +\code{\link{gce_make_firewall_rule}()}, +\code{\link{gce_make_firewall_webports}()} } \concept{firewall functions} diff --git a/man/gce_get_disk.Rd b/man/gce_get_disk.Rd index 0b94cb2..dca85fb 100644 --- a/man/gce_get_disk.Rd +++ b/man/gce_get_disk.Rd @@ -4,8 +4,11 @@ \alias{gce_get_disk} \title{Returns a specified persistent disk.} \usage{ -gce_get_disk(disk, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_get_disk( + disk, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{disk}{Name of the persistent disk to return} diff --git a/man/gce_get_firewall_rule.Rd b/man/gce_get_firewall_rule.Rd index f93d92a..f9c40f2 100644 --- a/man/gce_get_firewall_rule.Rd +++ b/man/gce_get_firewall_rule.Rd @@ -17,9 +17,10 @@ Get a firewall rule of name specified \seealso{ API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/get} -Other firewall functions: \code{\link{gce_delete_firewall_rule}}, - \code{\link{gce_list_firewall_rules}}, - \code{\link{gce_make_firewall_rule}}, - \code{\link{gce_make_firewall_webports}} +Other firewall functions: +\code{\link{gce_delete_firewall_rule}()}, +\code{\link{gce_list_firewall_rules}()}, +\code{\link{gce_make_firewall_rule}()}, +\code{\link{gce_make_firewall_webports}()} } \concept{firewall functions} diff --git a/man/gce_get_instance.Rd b/man/gce_get_instance.Rd index f2a97e9..1137f60 100644 --- a/man/gce_get_instance.Rd +++ b/man/gce_get_instance.Rd @@ -4,8 +4,11 @@ \alias{gce_get_instance} \title{Returns the specified Instance resource.} \usage{ -gce_get_instance(instance, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_get_instance( + instance, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instance}{Name of the instance resource} diff --git a/man/gce_get_machinetype.Rd b/man/gce_get_machinetype.Rd index 3058adc..656215f 100644 --- a/man/gce_get_machinetype.Rd +++ b/man/gce_get_machinetype.Rd @@ -4,8 +4,11 @@ \alias{gce_get_machinetype} \title{Returns the specified machine type.} \usage{ -gce_get_machinetype(machineType, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_get_machinetype( + machineType, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{machineType}{Name of the machine type to return} diff --git a/man/gce_list_disks.Rd b/man/gce_list_disks.Rd index 708e466..8efe6a6 100644 --- a/man/gce_list_disks.Rd +++ b/man/gce_list_disks.Rd @@ -4,8 +4,13 @@ \alias{gce_list_disks} \title{Retrieves a list of persistent disks contained within the specified zone.} \usage{ -gce_list_disks(filter = NULL, maxResults = NULL, pageToken = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_list_disks( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_disks_all.Rd b/man/gce_list_disks_all.Rd index d076811..4724021 100644 --- a/man/gce_list_disks_all.Rd +++ b/man/gce_list_disks_all.Rd @@ -4,8 +4,12 @@ \alias{gce_list_disks_all} \title{Retrieves an aggregated list of persistent disks across all zones.} \usage{ -gce_list_disks_all(filter = NULL, maxResults = NULL, - pageToken = NULL, project = gce_get_global_project()) +gce_list_disks_all( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_firewall_rules.Rd b/man/gce_list_firewall_rules.Rd index 889890f..2845472 100644 --- a/man/gce_list_firewall_rules.Rd +++ b/man/gce_list_firewall_rules.Rd @@ -4,8 +4,12 @@ \alias{gce_list_firewall_rules} \title{List firewall rules} \usage{ -gce_list_firewall_rules(filter = NULL, maxResults = NULL, - pageToken = NULL, project = gce_get_global_project()) +gce_list_firewall_rules( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} @@ -22,9 +26,10 @@ Get a firewall rule of name specified \seealso{ API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/list} -Other firewall functions: \code{\link{gce_delete_firewall_rule}}, - \code{\link{gce_get_firewall_rule}}, - \code{\link{gce_make_firewall_rule}}, - \code{\link{gce_make_firewall_webports}} +Other firewall functions: +\code{\link{gce_delete_firewall_rule}()}, +\code{\link{gce_get_firewall_rule}()}, +\code{\link{gce_make_firewall_rule}()}, +\code{\link{gce_make_firewall_webports}()} } \concept{firewall functions} diff --git a/man/gce_list_gpus.Rd b/man/gce_list_gpus.Rd index 7f1a22b..0e38946 100644 --- a/man/gce_list_gpus.Rd +++ b/man/gce_list_gpus.Rd @@ -4,8 +4,13 @@ \alias{gce_list_gpus} \title{Retrieves a list GPUs you can attach to an instance} \usage{ -gce_list_gpus(filter = NULL, maxResults = NULL, pageToken = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_list_gpus( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} @@ -28,7 +33,8 @@ To filter you need a single string in the form \code{field_name eq|ne string} \seealso{ \href{https://cloud.google.com/compute/docs/gpus/#introduction}{GPUs on Compute Engine} -Other GPU instances: \code{\link{gce_check_gpu}}, - \code{\link{gce_vm_gpu}} +Other GPU instances: +\code{\link{gce_check_gpu}()}, +\code{\link{gce_vm_gpu}()} } \concept{GPU instances} diff --git a/man/gce_list_images.Rd b/man/gce_list_images.Rd index c4c171a..83b3225 100644 --- a/man/gce_list_images.Rd +++ b/man/gce_list_images.Rd @@ -4,8 +4,12 @@ \alias{gce_list_images} \title{Retrieves the list of private images available to the specified project.} \usage{ -gce_list_images(image_project, filter = NULL, maxResults = NULL, - pageToken = NULL) +gce_list_images( + image_project, + filter = NULL, + maxResults = NULL, + pageToken = NULL +) } \arguments{ \item{image_project}{Project ID for this request} diff --git a/man/gce_list_instances.Rd b/man/gce_list_instances.Rd index d656c9a..ddd4ac3 100644 --- a/man/gce_list_instances.Rd +++ b/man/gce_list_instances.Rd @@ -4,9 +4,13 @@ \alias{gce_list_instances} \title{Retrieves the list of instances contained within the specified zone.} \usage{ -gce_list_instances(filter = NULL, maxResults = NULL, - pageToken = NULL, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_list_instances( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_machinetype.Rd b/man/gce_list_machinetype.Rd index 5de8821..204ead3 100644 --- a/man/gce_list_machinetype.Rd +++ b/man/gce_list_machinetype.Rd @@ -4,9 +4,13 @@ \alias{gce_list_machinetype} \title{Retrieves a list of machine types available to the specified project.} \usage{ -gce_list_machinetype(filter = NULL, maxResults = NULL, - pageToken = NULL, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_list_machinetype( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_machinetype_all.Rd b/man/gce_list_machinetype_all.Rd index c618b3c..ca00506 100644 --- a/man/gce_list_machinetype_all.Rd +++ b/man/gce_list_machinetype_all.Rd @@ -4,8 +4,12 @@ \alias{gce_list_machinetype_all} \title{Retrieves an aggregated list of machine types from all zones.} \usage{ -gce_list_machinetype_all(filter = NULL, maxResults = NULL, - pageToken = NULL, project = gce_get_global_project()) +gce_list_machinetype_all( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_networks.Rd b/man/gce_list_networks.Rd index 21dcece..f97cc64 100644 --- a/man/gce_list_networks.Rd +++ b/man/gce_list_networks.Rd @@ -4,8 +4,12 @@ \alias{gce_list_networks} \title{Retrieves the list of networks available to the specified project.} \usage{ -gce_list_networks(filter = NULL, maxResults = NULL, pageToken = NULL, - project = gce_get_global_project()) +gce_list_networks( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_zone_op.Rd b/man/gce_list_zone_op.Rd index b351506..145d1a3 100644 --- a/man/gce_list_zone_op.Rd +++ b/man/gce_list_zone_op.Rd @@ -4,8 +4,13 @@ \alias{gce_list_zone_op} \title{Retrieves a list of Operation resources contained within the specified zone.} \usage{ -gce_list_zone_op(filter = NULL, maxResults = NULL, pageToken = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_list_zone_op( + filter = NULL, + maxResults = NULL, + pageToken = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{filter}{Sets a filter expression for filtering listed resources, in the form filter={expression}} diff --git a/man/gce_list_zones.Rd b/man/gce_list_zones.Rd index e772fd2..ed6b782 100644 --- a/man/gce_list_zones.Rd +++ b/man/gce_list_zones.Rd @@ -4,8 +4,7 @@ \alias{gce_list_zones} \title{Retrieves the list of Zone resources available to the specified project.} \usage{ -gce_list_zones(project, filter = NULL, maxResults = NULL, - pageToken = NULL) +gce_list_zones(project, filter = NULL, maxResults = NULL, pageToken = NULL) } \arguments{ \item{project}{Project ID for this request} diff --git a/man/gce_make_boot_disk.Rd b/man/gce_make_boot_disk.Rd index 9ea9ae8..4fecdb8 100644 --- a/man/gce_make_boot_disk.Rd +++ b/man/gce_make_boot_disk.Rd @@ -4,9 +4,13 @@ \alias{gce_make_boot_disk} \title{Make a boot disk for attachment to an instance} \usage{ -gce_make_boot_disk(diskName = NULL, diskSizeGb = NULL, - diskType = NULL, sourceImage = NULL, - sourceImageEncryptionKey = NULL) +gce_make_boot_disk( + diskName = NULL, + diskSizeGb = NULL, + diskType = NULL, + sourceImage = NULL, + sourceImageEncryptionKey = NULL +) } \arguments{ \item{diskName}{Specifies the disk name} diff --git a/man/gce_make_disk.Rd b/man/gce_make_disk.Rd index 0390d25..ef30ada 100644 --- a/man/gce_make_disk.Rd +++ b/man/gce_make_disk.Rd @@ -4,11 +4,20 @@ \alias{gce_make_disk} \title{Creates a persistent disk in the specified project using the data in the request.} \usage{ -gce_make_disk(name, sourceImage = NULL, sizeGb = NULL, - description = NULL, diskEncryptionKey = NULL, licenses = NULL, - sourceSnapshot = NULL, sourceImageEncryptionKey = NULL, - sourceSnapshotEncryptionKey = NULL, type = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_make_disk( + name, + sourceImage = NULL, + sizeGb = NULL, + description = NULL, + diskEncryptionKey = NULL, + licenses = NULL, + sourceSnapshot = NULL, + sourceImageEncryptionKey = NULL, + sourceSnapshotEncryptionKey = NULL, + type = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{name}{Name of the resource} diff --git a/man/gce_make_firewall_rule.Rd b/man/gce_make_firewall_rule.Rd index 0c7df9c..9f11bd5 100644 --- a/man/gce_make_firewall_rule.Rd +++ b/man/gce_make_firewall_rule.Rd @@ -4,8 +4,14 @@ \alias{gce_make_firewall_rule} \title{Add one firewall rule to the network} \usage{ -gce_make_firewall_rule(name, protocol, ports, sourceRanges = NULL, - sourceTags = NULL, project = gce_get_global_project()) +gce_make_firewall_rule( + name, + protocol, + ports, + sourceRanges = NULL, + sourceTags = NULL, + project = gce_get_global_project() +) } \arguments{ \item{name}{Name of the firewall rule} @@ -49,9 +55,10 @@ If both properties are set, \seealso{ API Documentation \url{https://cloud.google.com/compute/docs/reference/latest/firewalls/insert} -Other firewall functions: \code{\link{gce_delete_firewall_rule}}, - \code{\link{gce_get_firewall_rule}}, - \code{\link{gce_list_firewall_rules}}, - \code{\link{gce_make_firewall_webports}} +Other firewall functions: +\code{\link{gce_delete_firewall_rule}()}, +\code{\link{gce_get_firewall_rule}()}, +\code{\link{gce_list_firewall_rules}()}, +\code{\link{gce_make_firewall_webports}()} } \concept{firewall functions} diff --git a/man/gce_make_firewall_webports.Rd b/man/gce_make_firewall_webports.Rd index 4fbbd25..1e3497c 100644 --- a/man/gce_make_firewall_webports.Rd +++ b/man/gce_make_firewall_webports.Rd @@ -20,9 +20,10 @@ This will invoke \link{gce_make_firewall_rule} and look for the rules named \cod If not present, it will create them. } \seealso{ -Other firewall functions: \code{\link{gce_delete_firewall_rule}}, - \code{\link{gce_get_firewall_rule}}, - \code{\link{gce_list_firewall_rules}}, - \code{\link{gce_make_firewall_rule}} +Other firewall functions: +\code{\link{gce_delete_firewall_rule}()}, +\code{\link{gce_get_firewall_rule}()}, +\code{\link{gce_list_firewall_rules}()}, +\code{\link{gce_make_firewall_rule}()} } \concept{firewall functions} diff --git a/man/gce_make_machinetype_url.Rd b/man/gce_make_machinetype_url.Rd index c56979e..7a4ebc3 100644 --- a/man/gce_make_machinetype_url.Rd +++ b/man/gce_make_machinetype_url.Rd @@ -4,8 +4,12 @@ \alias{gce_make_machinetype_url} \title{Construct a machineType URL} \usage{ -gce_make_machinetype_url(predefined_type = NULL, cpus = NULL, - memory = NULL, zone = gce_get_global_zone()) +gce_make_machinetype_url( + predefined_type = NULL, + cpus = NULL, + memory = NULL, + zone = gce_get_global_zone() +) } \arguments{ \item{predefined_type}{A predefined machine type from \link{gce_list_machinetype}} diff --git a/man/gce_make_network.Rd b/man/gce_make_network.Rd index 97548e9..00dad8d 100644 --- a/man/gce_make_network.Rd +++ b/man/gce_make_network.Rd @@ -4,19 +4,27 @@ \alias{gce_make_network} \title{Make a network interface for instance creation} \usage{ -gce_make_network(name, network = "default", externalIP = NULL, - project = gce_get_global_project()) +gce_make_network( + network = "default", + name = NULL, + subnetwork = NULL, + externalIP = NULL, + reservedIp = NULL, + project = gce_get_global_project() +) } \arguments{ -\item{name}{Name of the access config} - \item{network}{Name of network resource} -\item{externalIP}{An external IP you have created previously, leave NULL to have one assigned or "none" for none} +\item{name}{Name of the access config} -\item{project}{Project ID for this request +\item{subnetwork}{A subnetwork name if its exists You need to provide accessConfig explicitly if you want an ephemeral IP assigned, see \code{https://cloud.google.com/compute/docs/vm-ip-addresses}} + +\item{externalIP}{An external IP you have created previously, leave NULL to have one assigned or "none" for none} + +\item{project}{Project ID for this request} } \value{ A Network object @@ -24,4 +32,3 @@ A Network object \description{ Make a network interface for instance creation } -\keyword{internal} diff --git a/man/gce_pull_registry.Rd b/man/gce_pull_registry.Rd index 293c5da..5a0fc1e 100644 --- a/man/gce_pull_registry.Rd +++ b/man/gce_pull_registry.Rd @@ -4,8 +4,14 @@ \alias{gce_pull_registry} \title{Load a previously saved private Google Container} \usage{ -gce_pull_registry(instance, container_name, container_url = "gcr.io", - pull_only = FALSE, project = gce_get_global_project(), ...) +gce_pull_registry( + instance, + container_name, + container_url = "gcr.io", + pull_only = FALSE, + project = gce_get_global_project(), + ... +) } \arguments{ \item{instance}{The VM to run within} @@ -34,7 +40,8 @@ The instance Load a previously saved private Google Container } \seealso{ -Other container registry functions: \code{\link{gce_push_registry}}, - \code{\link{gce_tag_container}} +Other container registry functions: +\code{\link{gce_push_registry}()}, +\code{\link{gce_tag_container}()} } \concept{container registry functions} diff --git a/man/gce_push_registry.Rd b/man/gce_push_registry.Rd index fa91464..84ed462 100644 --- a/man/gce_push_registry.Rd +++ b/man/gce_push_registry.Rd @@ -4,9 +4,15 @@ \alias{gce_push_registry} \title{Push to Google Container Registry} \usage{ -gce_push_registry(instance, save_name, container_name = NULL, - image_name = NULL, container_url = "gcr.io", - project = gce_get_global_project(), wait = FALSE) +gce_push_registry( + instance, + save_name, + container_name = NULL, + image_name = NULL, + container_url = "gcr.io", + project = gce_get_global_project(), + wait = FALSE +) } \arguments{ \item{instance}{The VM to run within} @@ -36,7 +42,8 @@ The tag the image was tagged with on GCE Commit and save a running container or docker image to the Google Container Registry } \seealso{ -Other container registry functions: \code{\link{gce_pull_registry}}, - \code{\link{gce_tag_container}} +Other container registry functions: +\code{\link{gce_pull_registry}()}, +\code{\link{gce_tag_container}()} } \concept{container registry functions} diff --git a/man/gce_rstudio_adduser.Rd b/man/gce_rstudio_adduser.Rd index 415fb51..ccff96a 100644 --- a/man/gce_rstudio_adduser.Rd +++ b/man/gce_rstudio_adduser.Rd @@ -4,8 +4,13 @@ \alias{gce_rstudio_adduser} \title{Creates a user on an RStudio templated instance} \usage{ -gce_rstudio_adduser(instance, username, password, admin = TRUE, - container = "rstudio") +gce_rstudio_adduser( + instance, + username, + password, + admin = TRUE, + container = "rstudio" +) } \arguments{ \item{instance}{An instance with RStudio installed via \link{gce_vm_template}} diff --git a/man/gce_schedule_docker.Rd b/man/gce_schedule_docker.Rd index 3294503..451c863 100644 --- a/man/gce_schedule_docker.Rd +++ b/man/gce_schedule_docker.Rd @@ -4,8 +4,11 @@ \alias{gce_schedule_docker} \title{Schedule running a docker image upon a VM} \usage{ -gce_schedule_docker(docker_image, schedule = "53 4 * * *", - vm = gce_vm_scheduler()) +gce_schedule_docker( + docker_image, + schedule = "53 4 * * *", + vm = gce_vm_scheduler() +) } \arguments{ \item{docker_image}{the hosted docker image to run on a schedule} @@ -83,6 +86,7 @@ gce_schedule_docker(docker_tag, schedule = "53 4 * * *", vm = vm) } \seealso{ -Other scheduler functions: \code{\link{gce_vm_scheduler}} +Other scheduler functions: +\code{\link{gce_vm_scheduler}()} } \concept{scheduler functions} diff --git a/man/gce_set_machinetype.Rd b/man/gce_set_machinetype.Rd index a4b35ba..b7d1582 100644 --- a/man/gce_set_machinetype.Rd +++ b/man/gce_set_machinetype.Rd @@ -4,8 +4,14 @@ \alias{gce_set_machinetype} \title{Changes the machine type for a stopped instance to the machine type specified in the request.} \usage{ -gce_set_machinetype(predefined_type, cpus, memory, instance, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_set_machinetype( + predefined_type, + cpus, + memory, + instance, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{predefined_type}{A predefined machine type from \link{gce_list_machinetype}} diff --git a/man/gce_set_metadata.Rd b/man/gce_set_metadata.Rd index 144c399..32fb2fa 100644 --- a/man/gce_set_metadata.Rd +++ b/man/gce_set_metadata.Rd @@ -4,8 +4,12 @@ \alias{gce_set_metadata} \title{Sets metadata for the specified instance or projectwise to the data included in the request.} \usage{ -gce_set_metadata(metadata, instance, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_set_metadata( + metadata, + instance, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{metadata}{A named list of metadata key/value pairs to assign to this instance} @@ -47,6 +51,7 @@ To delete metadata pass an empty string \code{""} with the same key \seealso{ \href{https://developers.google.com/compute/docs/reference/latest/}{Google Documentation} -Other Metadata functions: \code{\link{Metadata}} +Other Metadata functions: +\code{\link{Metadata}()} } \concept{Metadata functions} diff --git a/man/gce_ssh.Rd b/man/gce_ssh.Rd index b20b352..ee62955 100644 --- a/man/gce_ssh.Rd +++ b/man/gce_ssh.Rd @@ -6,16 +6,38 @@ \alias{gce_ssh_download} \title{Remotely execute ssh code, upload & download files.} \usage{ -gce_ssh(instance, ..., key.pub = NULL, key.private = NULL, - wait = TRUE, capture_text = "", username = Sys.info()[["user"]]) - -gce_ssh_upload(instance, local, remote, username = Sys.info()[["user"]], - key.pub = NULL, key.private = NULL, verbose = FALSE, wait = TRUE) - -gce_ssh_download(instance, remote, local, - username = Sys.info()[["user"]], key.pub = NULL, - key.private = NULL, verbose = FALSE, overwrite = FALSE, - wait = TRUE) +gce_ssh( + instance, + ..., + key.pub = NULL, + key.private = NULL, + wait = TRUE, + capture_text = "", + username = Sys.info()[["user"]] +) + +gce_ssh_upload( + instance, + local, + remote, + username = Sys.info()[["user"]], + key.pub = NULL, + key.private = NULL, + verbose = FALSE, + wait = TRUE +) + +gce_ssh_download( + instance, + remote, + local, + username = Sys.info()[["user"]], + key.pub = NULL, + key.private = NULL, + verbose = FALSE, + overwrite = FALSE, + wait = TRUE +) } \arguments{ \item{instance}{Name of the instance of run ssh command upon} @@ -72,7 +94,7 @@ everything inside the directory will also be downloaded. #> foo ## if running on Windows, use the RStudio default SSH client - ## e.g. add C:\\Program Files\\RStudio\\bin\\msys-ssh-1000-18 to your PATH + ## e.g. add C:\Program Files\RStudio\bin\msys-ssh-1000-18 to your PATH ## then run: vm2 <- gce_vm("my-instance2") @@ -94,8 +116,9 @@ everything inside the directory will also be downloaded. \seealso{ \url{https://cloud.google.com/compute/docs/instances/connecting-to-instance} -Other ssh functions: \code{\link{gce_ssh_addkeys}}, - \code{\link{gce_ssh_browser}}, - \code{\link{gce_ssh_setup}} +Other ssh functions: +\code{\link{gce_ssh_addkeys}()}, +\code{\link{gce_ssh_browser}()}, +\code{\link{gce_ssh_setup}()} } \concept{ssh functions} diff --git a/man/gce_ssh_addkeys.Rd b/man/gce_ssh_addkeys.Rd index f35891a..2a34b9a 100644 --- a/man/gce_ssh_addkeys.Rd +++ b/man/gce_ssh_addkeys.Rd @@ -4,8 +4,13 @@ \alias{gce_ssh_addkeys} \title{Add SSH details to a gce_instance} \usage{ -gce_ssh_addkeys(instance, key.pub = NULL, key.private = NULL, - username = Sys.info()[["user"]], overwrite = FALSE) +gce_ssh_addkeys( + instance, + key.pub = NULL, + key.private = NULL, + username = Sys.info()[["user"]], + overwrite = FALSE +) } \arguments{ \item{instance}{The gce_instance} @@ -48,7 +53,7 @@ If key.pub is NULL then will look for default Google credentials at ## if running on Windows, use the RStudio default SSH client - ## e.g. add C:\\Program Files\\RStudio\\bin\\msys-ssh-1000-18 to your PATH + ## e.g. add C:\Program Files\RStudio\bin\msys-ssh-1000-18 to your PATH ## then run: vm2 <- gce_vm("my-instance2") @@ -69,7 +74,9 @@ If key.pub is NULL then will look for default Google credentials at } } \seealso{ -Other ssh functions: \code{\link{gce_ssh_browser}}, - \code{\link{gce_ssh_setup}}, \code{\link{gce_ssh}} +Other ssh functions: +\code{\link{gce_ssh_browser}()}, +\code{\link{gce_ssh_setup}()}, +\code{\link{gce_ssh}()} } \concept{ssh functions} diff --git a/man/gce_ssh_browser.Rd b/man/gce_ssh_browser.Rd index 0dbf42b..48563bf 100644 --- a/man/gce_ssh_browser.Rd +++ b/man/gce_ssh_browser.Rd @@ -21,7 +21,9 @@ You will need to login the first time with an email that has access to the insta \seealso{ \url{https://cloud.google.com/compute/docs/ssh-in-browser} -Other ssh functions: \code{\link{gce_ssh_addkeys}}, - \code{\link{gce_ssh_setup}}, \code{\link{gce_ssh}} +Other ssh functions: +\code{\link{gce_ssh_addkeys}()}, +\code{\link{gce_ssh_setup}()}, +\code{\link{gce_ssh}()} } \concept{ssh functions} diff --git a/man/gce_ssh_setup.Rd b/man/gce_ssh_setup.Rd index 6a3ef15..2646671 100644 --- a/man/gce_ssh_setup.Rd +++ b/man/gce_ssh_setup.Rd @@ -4,8 +4,13 @@ \alias{gce_ssh_setup} \title{Setup a SSH connection with GCE from a new SSH key-pair} \usage{ -gce_ssh_setup(instance, key.pub = NULL, key.private = NULL, - ssh_overwrite = FALSE, username = Sys.info()[["user"]]) +gce_ssh_setup( + instance, + key.pub = NULL, + key.private = NULL, + ssh_overwrite = FALSE, + username = Sys.info()[["user"]] +) } \arguments{ \item{instance}{Name of the instance of run ssh command upon} @@ -50,7 +55,7 @@ These will be looked for and used if found, at \code{file.path(Sys.getenv("HOME" ## if running on Windows, use the RStudio default SSH client - ## e.g. add C:\\Program Files\\RStudio\\bin\\msys-ssh-1000-18 to your PATH + ## e.g. add C:\Program Files\RStudio\bin\msys-ssh-1000-18 to your PATH ## then run: vm2 <- gce_vm("my-instance2") @@ -73,7 +78,9 @@ These will be looked for and used if found, at \code{file.path(Sys.getenv("HOME" \seealso{ \url{https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys} -Other ssh functions: \code{\link{gce_ssh_addkeys}}, - \code{\link{gce_ssh_browser}}, \code{\link{gce_ssh}} +Other ssh functions: +\code{\link{gce_ssh_addkeys}()}, +\code{\link{gce_ssh_browser}()}, +\code{\link{gce_ssh}()} } \concept{ssh functions} diff --git a/man/gce_tag_container.Rd b/man/gce_tag_container.Rd index ef9f258..fabfa5b 100644 --- a/man/gce_tag_container.Rd +++ b/man/gce_tag_container.Rd @@ -4,8 +4,11 @@ \alias{gce_tag_container} \title{Return a container tag for Google Container Registry} \usage{ -gce_tag_container(container_name, project = gce_get_global_project(), - container_url = "gcr.io") +gce_tag_container( + container_name, + project = gce_get_global_project(), + container_url = "gcr.io" +) } \arguments{ \item{container_name}{A running docker container. Can't be set if \code{image_name} is too.} @@ -27,7 +30,8 @@ A tag for use in Google Container Registry Return a container tag for Google Container Registry } \seealso{ -Other container registry functions: \code{\link{gce_pull_registry}}, - \code{\link{gce_push_registry}} +Other container registry functions: +\code{\link{gce_pull_registry}()}, +\code{\link{gce_push_registry}()} } \concept{container registry functions} diff --git a/man/gce_vm.Rd b/man/gce_vm.Rd index c048b45..1a22fe3 100644 --- a/man/gce_vm.Rd +++ b/man/gce_vm.Rd @@ -4,39 +4,42 @@ \alias{gce_vm} \title{Create or fetch a virtual machine} \usage{ -gce_vm(name, ..., project = gce_get_global_project(), - zone = gce_get_global_zone(), open_webports = TRUE) +gce_vm( + name, + ..., + project = gce_get_global_project(), + zone = gce_get_global_zone(), + open_webports = TRUE +) } \arguments{ \item{name}{The name of the instance} -\item{...}{Arguments passed on to \code{gce_vm_create} -\describe{ - \item{image_project}{Project ID of where the image lies} - \item{image}{Name of the image resource to return} - \item{image_family}{Name of the image family to search for} - \item{disk_source}{Specifies a valid URL to an existing Persistent Disk resource.} - \item{network}{The name of the network interface} - \item{externalIP}{An external IP you have previously reserved, leave NULL to have one assigned or \code{"none"} for no external access.} - \item{minCpuPlatform}{Specify a minimum CPU platform as per \href{these Google docs}{https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform}} - \item{project}{Project ID for this request} - \item{zone}{The name of the zone for this request} - \item{dry_run}{whether to just create the request JSON} - \item{disk_size_gb}{If not NULL, override default size of the boot disk (size in GB)} - \item{use_beta}{If set to TRUE will use the beta version of the API. Should not be used for production purposes.} - \item{acceleratorCount}{Number of GPUs to add to instance. If using this, you may want to instead use \link{gce_vm_gpu} which sets some defaults for GPU instances.} - \item{acceleratorType}{Name of GPU to add, see \link{gce_list_gpus}} - \item{name}{The name of the resource, provided by the client when initially creating the resource} - \item{canIpForward}{Allows this instance to send and receive packets with non-matching destination or source IPs} - \item{description}{An optional description of this resource} - \item{metadata}{A named list of metadata key/value pairs assigned to this instance} - \item{scheduling}{Scheduling options for this instance, such as preemptible instances} - \item{serviceAccounts}{A list of service accounts, with their specified scopes, authorized for this instance} - \item{tags}{A list of tags to apply to this instance} - \item{predefined_type}{A predefined machine type from \link{gce_list_machinetype}} - \item{cpus}{If not defining \code{predefined_type}, the number of CPUs} - \item{memory}{If not defining \code{predefined_type}, amount of memory} -}} +\item{...}{ + Arguments passed on to \code{\link[=gce_vm_create]{gce_vm_create}} + \describe{ + \item{\code{image_project}}{Project ID of where the image lies} + \item{\code{image}}{Name of the image resource to return} + \item{\code{image_family}}{Name of the image family to search for} + \item{\code{disk_source}}{Specifies a valid URL to an existing Persistent Disk resource.} + \item{\code{network}}{The name of the network interface} + \item{\code{externalIP}}{An external IP you have previously reserved, leave NULL to have one assigned or \code{"none"} for no external access.} + \item{\code{minCpuPlatform}}{Specify a minimum CPU platform as per \href{these Google docs}{https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform}} + \item{\code{dry_run}}{whether to just create the request JSON} + \item{\code{disk_size_gb}}{If not NULL, override default size of the boot disk (size in GB)} + \item{\code{use_beta}}{If set to TRUE will use the beta version of the API. Should not be used for production purposes.} + \item{\code{acceleratorCount}}{Number of GPUs to add to instance. If using this, you may want to instead use \link{gce_vm_gpu} which sets some defaults for GPU instances.} + \item{\code{acceleratorType}}{Name of GPU to add, see \link{gce_list_gpus}} + \item{\code{canIpForward}}{Allows this instance to send and receive packets with non-matching destination or source IPs} + \item{\code{description}}{An optional description of this resource} + \item{\code{metadata}}{A named list of metadata key/value pairs assigned to this instance} + \item{\code{scheduling}}{Scheduling options for this instance, such as preemptible instances} + \item{\code{serviceAccounts}}{A list of service accounts, with their specified scopes, authorized for this instance} + \item{\code{tags}}{A list of tags to apply to this instance} + \item{\code{predefined_type}}{A predefined machine type from \link{gce_list_machinetype}} + \item{\code{cpus}}{If not defining \code{predefined_type}, the number of CPUs} + \item{\code{memory}}{If not defining \code{predefined_type}, amount of memory} + }} \item{project}{Project ID for this request} diff --git a/man/gce_vm_cluster.Rd b/man/gce_vm_cluster.Rd index dba5d90..d7e46d3 100644 --- a/man/gce_vm_cluster.Rd +++ b/man/gce_vm_cluster.Rd @@ -4,9 +4,15 @@ \alias{gce_vm_cluster} \title{Make a VM cluster suitable for running parallel workloads} \usage{ -gce_vm_cluster(vm_prefix = "r-cluster-", cluster_size = 3, - docker_image = "rocker/r-parallel", ..., ssh_args = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone()) +gce_vm_cluster( + vm_prefix = "r-cluster-", + cluster_size = 3, + docker_image = "rocker/r-parallel", + ..., + ssh_args = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{vm_prefix}{The prefix of the VMs you want to make. Will be appended the cluster number} diff --git a/man/gce_vm_container.Rd b/man/gce_vm_container.Rd index 327fc3d..3457fc0 100644 --- a/man/gce_vm_container.Rd +++ b/man/gce_vm_container.Rd @@ -4,8 +4,14 @@ \alias{gce_vm_container} \title{Launch a container-VM image} \usage{ -gce_vm_container(file = NULL, cloud_init = NULL, shell_script = NULL, - image_family = "cos-stable", image_project = "cos-cloud", ...) +gce_vm_container( + file = NULL, + cloud_init = NULL, + shell_script = NULL, + image_family = "cos-stable", + image_project = "cos-cloud", + ... +) } \arguments{ \item{file}{file location of a valid cloud-init or shell_script file. diff --git a/man/gce_vm_create.Rd b/man/gce_vm_create.Rd index 0b55b0f..af6e548 100644 --- a/man/gce_vm_create.Rd +++ b/man/gce_vm_create.Rd @@ -4,15 +4,32 @@ \alias{gce_vm_create} \title{Creates an instance resource in the specified project using the data included in the request.} \usage{ -gce_vm_create(name, predefined_type = "f1-micro", - image_project = "debian-cloud", image_family = "debian-8", - cpus = NULL, memory = NULL, image = "", disk_source = NULL, - network = "default", externalIP = NULL, canIpForward = NULL, - description = NULL, metadata = NULL, scheduling = NULL, - serviceAccounts = NULL, tags = NULL, minCpuPlatform = NULL, - project = gce_get_global_project(), zone = gce_get_global_zone(), - dry_run = FALSE, disk_size_gb = NULL, use_beta = FALSE, - acceleratorCount = NULL, acceleratorType = "nvidia-tesla-p4") +gce_vm_create( + name, + predefined_type = "f1-micro", + image_project = "debian-cloud", + image_family = "debian-9", + cpus = NULL, + memory = NULL, + image = "", + disk_source = NULL, + network = gce_make_network("default"), + externalIP = NULL, + canIpForward = NULL, + description = NULL, + metadata = NULL, + scheduling = NULL, + serviceAccounts = NULL, + tags = NULL, + minCpuPlatform = NULL, + project = gce_get_global_project(), + zone = gce_get_global_zone(), + dry_run = FALSE, + disk_size_gb = NULL, + use_beta = FALSE, + acceleratorCount = NULL, + acceleratorType = "nvidia-tesla-p4" +) } \arguments{ \item{name}{The name of the resource, provided by the client when initially creating the resource} diff --git a/man/gce_vm_delete.Rd b/man/gce_vm_delete.Rd index 723fdb7..5b5faed 100644 --- a/man/gce_vm_delete.Rd +++ b/man/gce_vm_delete.Rd @@ -4,8 +4,11 @@ \alias{gce_vm_delete} \title{Deletes the specified Instance resource.} \usage{ -gce_vm_delete(instances, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_vm_delete( + instances, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instances}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}} diff --git a/man/gce_vm_deletion_protection.Rd b/man/gce_vm_deletion_protection.Rd index 6b22769..ee9ff70 100644 --- a/man/gce_vm_deletion_protection.Rd +++ b/man/gce_vm_deletion_protection.Rd @@ -4,8 +4,12 @@ \alias{gce_vm_deletion_protection} \title{Toggle deletion protection for existing instances} \usage{ -gce_vm_deletion_protection(instance, cmd = c("status", "true", "false"), - projectId = gce_get_global_project(), zone = gce_get_global_zone()) +gce_vm_deletion_protection( + instance, + cmd = c("status", "true", "false"), + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instance}{The vm to work with its deletion protection} @@ -13,10 +17,34 @@ gce_vm_deletion_protection(instance, cmd = c("status", "true", "false"), \item{cmd}{Whether to get the status, or toggle "true" or "false" on deletion protection for this VM} -\item{projectId}{The projectId} +\item{project}{The projectId} \item{zone}{The zone} } \description{ Toggle deletion protection for existing instances } +\examples{ + +\dontrun{ + +# a workflow for deleting lots of VMs across zones that have deletion protection +zones <- gce_list_zones() +instances <- lapply(zones$name, function(x) gce_list_instances(zone = x)) + +instances_e <- lapply(instances, function(x) x$items$name) +names(instances_e) <- zones$name + +status <- lapply(zones$name, function(x){ + lapply(instances_e[[x]], function(y) { + gce_vm_deletion_protection(y, cmd = "false", zone = x))) + } + } + +deletes <- lapply(zones$name, function(x){ + lapply(instances_e[[x]], function(y) { + gce_vm_delete(y, zone = x))) + } + } +} +} diff --git a/man/gce_vm_gpu.Rd b/man/gce_vm_gpu.Rd index 4e41526..fdd0bdf 100644 --- a/man/gce_vm_gpu.Rd +++ b/man/gce_vm_gpu.Rd @@ -33,7 +33,8 @@ If not specified, this function will enter defaults to get a GPU instance up and \seealso{ \href{Deep Learning VM}{https://cloud.google.com/deep-learning-vm/docs/quickstart-cli} -Other GPU instances: \code{\link{gce_check_gpu}}, - \code{\link{gce_list_gpus}} +Other GPU instances: +\code{\link{gce_check_gpu}()}, +\code{\link{gce_list_gpus}()} } \concept{GPU instances} diff --git a/man/gce_vm_reset.Rd b/man/gce_vm_reset.Rd index 7b815e6..bb1effb 100644 --- a/man/gce_vm_reset.Rd +++ b/man/gce_vm_reset.Rd @@ -4,8 +4,11 @@ \alias{gce_vm_reset} \title{Performs a hard reset on the instance.} \usage{ -gce_vm_reset(instances, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_vm_reset( + instances, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instances}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}} diff --git a/man/gce_vm_scheduler.Rd b/man/gce_vm_scheduler.Rd index b2c188a..36c40b4 100644 --- a/man/gce_vm_scheduler.Rd +++ b/man/gce_vm_scheduler.Rd @@ -9,13 +9,14 @@ gce_vm_scheduler(vm_name = "scheduler", ...) \arguments{ \item{vm_name}{The name of the VM scheduler to create or return} -\item{...}{Arguments passed on to \code{gce_vm} -\describe{ - \item{name}{The name of the instance} - \item{open_webports}{If TRUE, will open firewall ports 80 and 443 if not open already} - \item{project}{Project ID for this request} - \item{zone}{The name of the zone for this request} -}} +\item{...}{ + Arguments passed on to \code{\link[=gce_vm]{gce_vm}} + \describe{ + \item{\code{name}}{The name of the instance} + \item{\code{open_webports}}{If TRUE, will open firewall ports 80 and 443 if not open already} + \item{\code{project}}{Project ID for this request} + \item{\code{zone}}{The name of the zone for this request} + }} } \value{ A VM object @@ -24,6 +25,7 @@ A VM object This starts up a VM with cron and docker installed that can be used to schedule scripts } \seealso{ -Other scheduler functions: \code{\link{gce_schedule_docker}} +Other scheduler functions: +\code{\link{gce_schedule_docker}()} } \concept{scheduler functions} diff --git a/man/gce_vm_start.Rd b/man/gce_vm_start.Rd index 31be1f3..f3dad8e 100644 --- a/man/gce_vm_start.Rd +++ b/man/gce_vm_start.Rd @@ -4,8 +4,11 @@ \alias{gce_vm_start} \title{Starts an instance that was stopped using the using the stop method.} \usage{ -gce_vm_start(instances, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_vm_start( + instances, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instances}{Name of the instance resource, or an instance object e.g. from \link{gce_get_instance}} diff --git a/man/gce_vm_stop.Rd b/man/gce_vm_stop.Rd index 27665e2..0ad68cb 100644 --- a/man/gce_vm_stop.Rd +++ b/man/gce_vm_stop.Rd @@ -4,8 +4,11 @@ \alias{gce_vm_stop} \title{Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time.} \usage{ -gce_vm_stop(instances, project = gce_get_global_project(), - zone = gce_get_global_zone()) +gce_vm_stop( + instances, + project = gce_get_global_project(), + zone = gce_get_global_zone() +) } \arguments{ \item{instances}{Names of the instance resource, or an instance object e.g. from \link{gce_get_instance}} diff --git a/man/gce_vm_template.Rd b/man/gce_vm_template.Rd index c70f957..55014bb 100644 --- a/man/gce_vm_template.Rd +++ b/man/gce_vm_template.Rd @@ -4,10 +4,16 @@ \alias{gce_vm_template} \title{Create a template container VM} \usage{ -gce_vm_template(template = c("rstudio", "shiny", "opencpu", "r-base", - "dynamic", "rstudio-gpu", "rstudio-shiny"), username = NULL, - password = NULL, dynamic_image = NULL, image_family = "cos-stable", - wait = TRUE, ...) +gce_vm_template( + template = c("rstudio", "shiny", "opencpu", "r-base", "dynamic", "rstudio-gpu", + "rstudio-shiny"), + username = NULL, + password = NULL, + dynamic_image = NULL, + image_family = "cos-stable", + wait = TRUE, + ... +) } \arguments{ \item{template}{The template available} @@ -22,15 +28,15 @@ gce_vm_template(template = c("rstudio", "shiny", "opencpu", "r-base", \item{wait}{Whether to wait for the VM to launch before returning. Default \code{TRUE}.} -\item{...}{Arguments passed on to \code{gce_vm_container} -\describe{ - \item{file}{file location of a valid cloud-init or shell_script file. +\item{...}{ + Arguments passed on to \code{\link[=gce_vm_container]{gce_vm_container}} + \describe{ + \item{\code{file}}{file location of a valid cloud-init or shell_script file. One of \code{file} or \code{cloud_init} or \code{shell_script} must be supplied} - \item{cloud_init}{contents of a cloud-init file, for example read via \code{readChar(file, nchars = 32768)}} - \item{shell_script}{contents of a shell_script file, for example read via \code{readChar(file, nchars = 32768)}} - \item{image_family}{An image-family. It must come from the \code{image_project} family.} - \item{image_project}{An image-project, where the image-family resides.} -}} + \item{\code{cloud_init}}{contents of a cloud-init file, for example read via \code{readChar(file, nchars = 32768)}} + \item{\code{shell_script}}{contents of a shell_script file, for example read via \code{readChar(file, nchars = 32768)}} + \item{\code{image_project}}{An image-project, where the image-family resides.} + }} } \value{ The VM object, or the VM startup operation if \code{wait=FALSE} diff --git a/man/googleComputeEngineR.Rd b/man/googleComputeEngineR.Rd index c4fff54..583a3b0 100644 --- a/man/googleComputeEngineR.Rd +++ b/man/googleComputeEngineR.Rd @@ -3,7 +3,6 @@ \docType{package} \name{googleComputeEngineR} \alias{googleComputeEngineR} -\alias{googleComputeEngineR-package} \title{Working with Google Compute Engine from R} \description{ See demos and examples at the \href{googleComputeEngineR website}{https://cloudyr.github.io/googleComputeEngineR/}. diff --git a/man/makeDockerClusterPSOCK.Rd b/man/makeDockerClusterPSOCK.Rd index c97b5ec..d3b3ced 100644 --- a/man/makeDockerClusterPSOCK.Rd +++ b/man/makeDockerClusterPSOCK.Rd @@ -4,9 +4,15 @@ \alias{makeDockerClusterPSOCK} \title{Make the Docker cluster on Google Compute Engine} \usage{ -makeDockerClusterPSOCK(workers, docker_image = "rocker/r-parallel", +makeDockerClusterPSOCK( + workers, + docker_image = "rocker/r-parallel", rscript = c("docker", "run", "--net=host", docker_image, "Rscript"), - rscript_args = NULL, install_future = FALSE, ..., verbose = FALSE) + rscript_args = NULL, + install_future = FALSE, + ..., + verbose = FALSE +) } \arguments{ \item{workers}{The VMs being called upon} diff --git a/vignettes/massive-parallel.html b/vignettes/massive-parallel.html index 97bc690..5424e33 100644 --- a/vignettes/massive-parallel.html +++ b/vignettes/massive-parallel.html @@ -1,11 +1,10 @@ - + - @@ -13,7 +12,7 @@ - + Massively parallel processing @@ -304,7 +303,7 @@

Massively parallel processing

Mark Edmondson

-

2019-11-02

+

2020-02-01

@@ -361,7 +360,7 @@

Create the cluster

Using your own Docker image

-

The default uses rocker/r-parallel as its image, but if you want your own custom image then create your own Docker image based on that one, for example via this tutorial using Google Build Triggers.

+

The default uses rocker/r-parallel as its image, but if you want your own custom image then create your own Docker image based on that one, for example via this tutorial using Google Build Triggers.

This will give you a docker image name such as gcr.io/my-project/my-r - use a version of the code below to use this in your cluster.

You can also customise the RScript command that launches your script, but always make sure to include --net=host as is shown in the default arguments, so the Docker image uses the SSH ports the host VM has (e.g. it can connect to your SSH commands)