Skip to content

Commit

Permalink
Merge pull request rstudio#2 from rstudio/feature/task-description
Browse files Browse the repository at this point in the history
Display task description instead of task status
  • Loading branch information
jjallaire committed Oct 8, 2013
2 parents ceb0e43 + be564b8 commit a81c63e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/deployApp.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ deployApp <- function(appDir = getwd(),
})

# wait for the deployment to complete (will raise an error if it can't)
displayStatus("Initializing application...\n")
displayStatus("Deploying application...\n")
lucid$waitForTaskCompletion(task$task_id, quiet)
displayStatus(paste("Application successfully deployed to", application$url))

Expand Down
20 changes: 12 additions & 8 deletions R/lucid.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,23 @@ lucidClient <- function(authInfo) {
waitForTaskCompletion = function(taskId, quiet = FALSE) {

path <- paste("/tasks/", taskId, sep="")


if (!quiet) {
cat("Waiting for task: ", taskId, "\n", sep="")
}

lastStatus <- NULL
while(TRUE) {
# check status
status <- handleResponse(GET(authInfo, path))

# display status to the user if it changed
if (!identical(lastStatus, status$description)) {
if (!quiet)
cat(" ", status$status, ": ", status$description, "\n", sep="")
lastStatus <- status$description
}

# are we finished? (note: this codepath is the only way to exit
# this function)
if (status$finished) {
Expand All @@ -72,13 +83,6 @@ lucidClient <- function(authInfo) {
stop(status$error, call. = FALSE)
}

# display status to the user if it changed
else if (!identical(lastStatus, status$status)) {
if (!quiet)
cat(" ", status$status, "\n", sep="")
lastStatus <- status$status
}

# wait for 1 second before polling again
Sys.sleep(1)
}
Expand Down

0 comments on commit a81c63e

Please sign in to comment.