Skip to content

Latest commit

 

History

History
60 lines (51 loc) · 1.66 KB

33-programmatically-generate-config.md

File metadata and controls

60 lines (51 loc) · 1.66 KB

Programmatically generated credential and cluster configuration

In addition to setting credentials and cluster configuration through json files, you can specify them programmatically. This allows users to generate the configuration on the fly at runtime.

Programmatically generated credentials

You can generate credentials by creating a R object as shown below:

  credentials <- list(
    "batchAccount" = list(
      "name" = "batchaccountname",
      "key" = "batchaccountkey",
      "url" = "https://batchaccountname.region.batch.azure.com"
    ),
    "storageAccount" = list(
      "name" = "storageaccountname",
      "key" = "storageaccountkey"
    ),
    "githubAuthenticationToken" = "",
    "dockerAuthentication" = list("username" = "",
                                  "password" = "",
                                  "registry" = "")
  )
  doAzureParallel::setCredentials(credentials)

Programmatically generated cluster configuration

You can generate cluster configuration by creating a R object as shown below:

  clusterConfig <- list(
    "name" = "clustername",
    "vmSize" = "Standard_D2_v2",
    "maxTasksPerNode" = 1,
    "poolSize" = list(
      "dedicatedNodes" = list(
        "min" = 0,
        "max" = 0
      ),
      "lowPriorityNodes" = list(
        "min" = 1,
        "max" = 1
      ),
      "autoscaleFormula" = "QUEUE"
    ),
    "containerImage" = "rocker/tidyverse:latest",
    "rPackages" = list(
      "cran" = list(),
      "github" = list(),
      "bioconductor" = list()
    ),
    "commandLine" = list()
  )

  cluster <- doAzureParallel::makeCluster(clusterConfig)
  doAzureParallel::registerDoAzureParallel(cluster)