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

Commit

Permalink
Added terminate job and added exitConditions for tasks (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
brnleehng authored Sep 28, 2017
1 parent 5c260a3 commit d2e55dc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
16 changes: 16 additions & 0 deletions R/job_operations.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,19 @@ getJobTaskCounts <- function(jobId, content = "parsed") {

callBatchService(request, batchCredentials, content)
}

terminateJob <- function(jobId, content = "response"){
batchCredentials <- getBatchCredentials()

headers <- c()
headers['Content-Length'] <- '0'

request <- AzureRequest$new(
method = "POST",
path = paste0("/jobs/", jobId, "/terminate"),
query = list("api-version" = apiVersion),
headers = headers
)

callBatchService(request, batchCredentials, content)
}
2 changes: 1 addition & 1 deletion R/storage_service.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ callStorageSas <- function(request, accountName, sasToken, ...) {
body = body
)

httr::stop_for_status(response)
response
}

prepareStorageRequest <- function(request, credentials) {
Expand Down
4 changes: 3 additions & 1 deletion R/task_operations.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ addTask <- function(jobId, taskId = "default", content = "parsed", ...){
commandLine <- args$commandLine
dependsOn <- args$dependsOn
outputFiles <- args$outputFiles
exitConditions <- args$exitConditions

if (is.null(commandLine)) {
stop("Task requires a command line.")
Expand All @@ -26,7 +27,8 @@ addTask <- function(jobId, taskId = "default", content = "parsed", ...){
outputFiles = outputFiles,
constraints = list(
maxTaskRetryCount = 3
))
),
exitConditions = exitConditions)

body <- Filter(length, body)

Expand Down

0 comments on commit d2e55dc

Please sign in to comment.