Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Fix: Resize Cluster (#371)
Browse files Browse the repository at this point in the history
* Added resize cluster

* Added fix for autoscale file
  • Loading branch information
brnleehng committed Oct 27, 2020
1 parent d206fd6 commit 56661a4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/autoscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ getAutoscaleFormula <-
#' @examples
#' \dontrun{
#' resizeCluster(cluster, dedicatedMin = 2, dedicatedMax = 6,
#' dedicatedMin = 2, dedicatedMax = 6, algorithm = "QUEUE", timeInterval = "PT10M")
#' lowPriorityMin = 2, lowPriorityMax = 6, algorithm = "QUEUE", timeInterval = "PT10M")
#' }
#' @export
resizeCluster <- function(cluster,
Expand All @@ -122,11 +122,13 @@ resizeCluster <- function(cluster,
algorithm = "QUEUE",
timeInterval = "PT5M") {
config <- getOption("az_config")

# Use the Pool GET API to get the correct pool properties: MaxTaskPerNodes
cluster <- config$batchClient$poolOperations$getPool(
cluster$poolId)

config$batchClient$poolOperations$resizePool(
cluster$poolId,
cluster$id,
autoscaleFormula = getAutoscaleFormula(
algorithm,
dedicatedMin,
Expand All @@ -137,4 +139,6 @@ resizeCluster <- function(cluster,
),
autoscaleInterval = timeInterval
)

print("Cluster autoscale formula has been updated. Run 'getCluster' for updated target node count.")
}

0 comments on commit 56661a4

Please sign in to comment.