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

Commit

Permalink
Merge pull request #36 from Azure/feature/getjobresult
Browse files Browse the repository at this point in the history
add counting service api
  • Loading branch information
zfengms authored Sep 28, 2017
2 parents e63872a + 2029d57 commit 5c260a3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/batch_service.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion <- "2017-05-01.5.0"
apiVersion <- "2017-06-01.5.1"

getBatchCredentials <- function(configPath = "az_config.json", ...) {
config <- getOption("az_config")
Expand Down
26 changes: 25 additions & 1 deletion R/job_operations.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ addJob <- function(jobId,
jobPreparationTask = NULL,
usesTaskDependencies = FALSE,
content = "parsed",
metadata = NULL,
...) {
batchCredentials <- getBatchCredentials()

body <- list(
id = jobId,
poolInfo = poolInfo,
jobPreparationTask = jobPreparationTask,
usesTaskDependencies = usesTaskDependencies
usesTaskDependencies = usesTaskDependencies,
metadata = metadata
)

body <- Filter(length, body)
Expand Down Expand Up @@ -129,3 +131,25 @@ getJobPreparationStatus <- function(jobId, content = "parsed", ...) {

callBatchService(request, batchCredentials, content)
}

#' Gets job task counts by job state.
#'
#' @param jobId The id of the job.
#'
#' @return A response containing the task counts of different states.
#' @examples
#' \dontrun{
#' getJobTaskCounts(job-001)
#' }
#' @export
getJobTaskCounts <- function(jobId, content = "parsed") {
batchCredentials <- getBatchCredentials()

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

callBatchService(request, batchCredentials, content)
}

0 comments on commit 5c260a3

Please sign in to comment.