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

Commit

Permalink
Fix: Updating Persistent Storage Documentation (#283)
Browse files Browse the repository at this point in the history
* Switched to R6 client

* Replaced createContainer function
  • Loading branch information
brnleehng committed Jun 27, 2018
1 parent 8e39df1 commit 2b8f388
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions docs/72-persistent-storage.md
Expand Up @@ -35,12 +35,32 @@ If the job is not completed, getJobResult will return the state of your job. Oth
Batch will automatically handle your output files when the user assigns a file pattern and storage container url.

```R
doAzureParallel::setCredentials("credentials.json")
# Using rAzureBatch directly for storage uploads
config <- rjson::fromJSON(file = paste0("credentials.json"))

storageCredentials <- rAzureBatch::SharedKeyCredentials$new(
name = config$sharedKey$storageAccount$name,
key = config$sharedKey$storageAccount$key
)

storageAccountName <- storageCredentials$name
inputContainerName <- "datasets"

storageClient <- rAzureBatch::StorageServiceClient$new(
authentication = storageCredentials,
url = sprintf("https://%s.blob.%s",
storageCredentials$name,
config$sharedKey$storageAccount$endpointSuffix
)
)

# Pushing output files
storageAccount <- "storageAccountName"
outputFolder <- "outputs"

createContainer(outputFolder)
writeToken <- rAzureBatch::createSasToken("w", "c", outputFolder)
storageClient$containerOperations$createContainer(outputFolder)
writeToken <- storageClient$generateSasToken("w", "c", outputFolder)
containerUrl <- rAzureBatch::createBlobUrl(storageAccount = storageAccount,
containerName = outputFolder,
sasToken = writeToken)
Expand All @@ -67,7 +87,7 @@ Note: The foreach object always expects a value. We use NULL as a default value

```R
# Bad practice
writeToken <- rAzureBatch::createSasToken("w", "c", outputFolder)
writeToken <- storageClient$generateSasToken("w", "c", outputFolder)
containerUrl <- rAzureBatch::createBlobUrl(storageAccount = storageAccount,
containerName = outputFolder,
sasToken = writeToken)
Expand Down

0 comments on commit 2b8f388

Please sign in to comment.