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

Commit

Permalink
Fix/storage management (#267)
Browse files Browse the repository at this point in the history
* Removed rAzureBatch from storage api calls

* Fixed quota documentation

* Added job and core quota limits
  • Loading branch information
brnleehng authored May 7, 2018
1 parent 6582af4 commit 84aa7c9
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 34 deletions.
4 changes: 2 additions & 2 deletions R/autoscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ resizeCluster <- function(cluster,
algorithm = "QUEUE",
timeInterval = "PT5M") {
config <- getOption("az_config")
pool <- config$batchClient$poolOperations$getPool(
cluster <- config$batchClient$poolOperations$getPool(
cluster$poolId)

rAzureBatch::resizePool(
config$batchClient$poolOperations$resizePool(
cluster$poolId,
autoscaleFormula = getAutoscaleFormula(
algorithm,
Expand Down
17 changes: 9 additions & 8 deletions R/cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ makeCluster <-
#' }
#' @export
getCluster <- function(clusterName, verbose = TRUE) {
config <- getOption("az_config")
config <- getConfiguration()

pool <- config$batchClient$poolOperations$getPool(
clusterName)

Expand Down Expand Up @@ -476,14 +477,14 @@ getClusterList <- function(filter = NULL) {
}
}

pools <-
rAzureBatch::listPools(
query = list(
"$filter" = filterClause,
"$select" = paste0("id,state,allocationState,vmSize,currentDedicatedNodes,",
"targetDedicatedNodes,currentLowPriorityNodes,targetLowPriorityNodes")
)
config <- getOption("az_config")
pools <- config$batchClient$poolOperations$listPools(
query = list(
"$filter" = filterClause,
"$select" = paste0("id,state,allocationState,vmSize,currentDedicatedNodes,",
"targetDedicatedNodes,currentLowPriorityNodes,targetLowPriorityNodes")
)
)

count <- length(pools$value)
id <- character(count)
Expand Down
25 changes: 15 additions & 10 deletions R/logging.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ getClusterFile <-

filePath <- sprintf(prefixfilePath, filePath)

nodeFileContent <- rAzureBatch::getNodeFile(
config <- getConfiguration()
batchClient <- config$batchClient

nodeFileContent <- batchClient$fileOperations$getNodeFile(
cluster$poolId,
nodeId,
filePath,
Expand Down Expand Up @@ -76,15 +79,17 @@ getJobFile <-
filePath <- substring(filePath, 2)
}

jobFileContent <-
rAzureBatch::getTaskFile(
jobId,
taskId,
filePath,
downloadPath = downloadPath,
overwrite = overwrite,
progress = TRUE
)
config <- getConfiguration()
batchClient <- config$batchClient

jobFileContent <- batchClient$fileOperations$getTaskFile(
jobId,
taskId,
filePath,
downloadPath = downloadPath,
overwrite = overwrite,
progress = TRUE
)

jobFileContent
}
45 changes: 33 additions & 12 deletions R/storage_management.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
#' }
#' @export
listStorageContainers <- function(prefix = "") {
config <- getConfiguration()
storageClient <- config$storageClient

xmlResponse <-
rAzureBatch::listContainers(prefix, content = "parsed")
storageClient$containerOperations$deleteContainer$listContainers(
prefix, content = "parsed")

name <- getXmlValues(xmlResponse, ".//Container/Name")
lastModified <-
Expand Down Expand Up @@ -74,8 +78,14 @@ deleteStorageContainer <- function(container, verbose = TRUE) {
#' }
#' @export
listStorageFiles <- function(container, prefix = "", ...) {
xmlResponse <-
rAzureBatch::listBlobs(container, prefix, content = "parsed", ...)
config <- getConfiguration()
storageClient <- config$storageClient

xmlResponse <- storageClient$blobOperations$listBlobs(
container,
prefix,
content = "parsed",
...)

filePath <- getXmlValues(xmlResponse, ".//Blob/Name")

Expand Down Expand Up @@ -126,14 +136,18 @@ getStorageFile <-
overwrite = FALSE,
verbose = TRUE,
...) {
jobFileContent <- rAzureBatch::downloadBlob(
container,
blobPath,
downloadPath = downloadPath,
overwrite = overwrite,
progress = TRUE,
...
)
config <- getConfiguration()
storageClient <- config$storageClient

jobFileContent <-
storageClient$blobOperations$downloadBlob(
container,
blobPath,
downloadPath = downloadPath,
overwrite = overwrite,
progress = TRUE,
...
)

jobFileContent
}
Expand All @@ -145,8 +159,15 @@ getStorageFile <-
#'
#' @export
deleteStorageFile <- function(container, blobPath, ...) {
config <- getConfiguration()
storageClient <- config$storageClient

response <-
rAzureBatch::deleteBlob(container, blobPath, content = "response", ...)
storageClient$blobOperations$deleteBlob(
container,
blobPath,
content = "response",
...)

if (response$status_code == 202) {
cat(
Expand Down
4 changes: 2 additions & 2 deletions docs/12-quota-limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Our default VM size selection is the **"Standard_F2"** that has 2 core per VM. W

## Number of *foreach* Loops

By default, doAzureParallel users are limited to running 20 *foreach* loops in Azure at a time. This is because each *foreach* loops generates a *job*, of which users are by default limited to 20. To go beyond that, users need to wait for their *jobs* to complete.
By default, doAzureParallel users are limited to running 20 *foreach* loops in Azure at a time. This is because each *foreach* loops generates a *job*, of which users are by default limited to 20.

## Increasing Your Quota
## Increasing Your Core and Job Quota

To increase your default quota limitations, please visit [this page](https://docs.microsoft.com/en-us/azure/batch/batch-quota-limit#increase-a-quota) for instructions.

0 comments on commit 84aa7c9

Please sign in to comment.