@@ -35,12 +35,32 @@ If the job is not completed, getJobResult will return the state of your job. Oth
3535Batch will automatically handle your output files when the user assigns a file pattern and storage container url.
3636
3737``` R
38+ doAzureParallel :: setCredentials(" credentials.json" )
39+ # Using rAzureBatch directly for storage uploads
40+ config <- rjson :: fromJSON(file = paste0(" credentials.json" ))
41+
42+ storageCredentials <- rAzureBatch :: SharedKeyCredentials $ new(
43+ name = config $ sharedKey $ storageAccount $ name ,
44+ key = config $ sharedKey $ storageAccount $ key
45+ )
46+
47+ storageAccountName <- storageCredentials $ name
48+ inputContainerName <- " datasets"
49+
50+ storageClient <- rAzureBatch :: StorageServiceClient $ new(
51+ authentication = storageCredentials ,
52+ url = sprintf(" https://%s.blob.%s" ,
53+ storageCredentials $ name ,
54+ config $ sharedKey $ storageAccount $ endpointSuffix
55+ )
56+ )
57+
3858# Pushing output files
3959storageAccount <- " storageAccountName"
4060outputFolder <- " outputs"
4161
42- createContainer(outputFolder )
43- writeToken <- rAzureBatch :: createSasToken (" w" , " c" , outputFolder )
62+ storageClient $ containerOperations $ createContainer(outputFolder )
63+ writeToken <- storageClient $ generateSasToken (" w" , " c" , outputFolder )
4464containerUrl <- rAzureBatch :: createBlobUrl(storageAccount = storageAccount ,
4565 containerName = outputFolder ,
4666 sasToken = writeToken )
@@ -67,7 +87,7 @@ Note: The foreach object always expects a value. We use NULL as a default value
6787
6888``` R
6989# Bad practice
70- writeToken <- rAzureBatch :: createSasToken (" w" , " c" , outputFolder )
90+ writeToken <- storageClient $ generateSasToken (" w" , " c" , outputFolder )
7191containerUrl <- rAzureBatch :: createBlobUrl(storageAccount = storageAccount ,
7292 containerName = outputFolder ,
7393 sasToken = writeToken )
0 commit comments