Skip to content

Commit

Permalink
Added Abort Experiment to package
Browse files Browse the repository at this point in the history
  • Loading branch information
kcratie committed Feb 12, 2016
1 parent 44aa3e0 commit 11ed370
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 11 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(GrapleAbortExperiment)
export(GrapleCheckExperimentCompletion)
export(GrapleCheckService)
export(GrapleGetExperimentJobResults)
Expand Down
37 changes: 30 additions & 7 deletions R/GrapleR.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
packageStartupMessage("GRAPLEr has been developed with support from a supplement the the PRAGMA award (NSF OCI-1234983). For more information, please visit graple.org")
}

#' @title Get the Graple Service Status
#' @title Get the GRAPLEr Service Status
#' @description
#' This function allows you to check the staus of the GRAPLEr web service.
#' @param submissionURL URL:Port of the GRAPLEr web service
Expand All @@ -18,10 +18,10 @@ GrapleCheckService<-function(submissionURL)
{
qurl<-paste(submissionURL, "service_status", sep="/")
status<- getURL(qurl)
return(status)
return(fromJSON(status))
}

#' @title Sends the experiment (multiple simulations) to be run on GrapleR
#' @title Sends the experiment (multiple simulations) to be run on GWS
#' This function allows you to run graple with an optional post-process filtering of results
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param ExperimentDir the experiment root folder
Expand Down Expand Up @@ -57,7 +57,7 @@ GrapleRunExperiment<-function(submissionURL, ExperimentDir, FilterName)
return (substr(expid[1], start=13, stop=52))
}

#' @title Check the Graple Experiment Status
#' @title Check the GRAPLEr Experiment Status
#' @description
#' This function allows you to check the staus of the GRAPLEr web service.
#' @param submissionURL URL:Port of the GRAPLEr web service
Expand All @@ -76,10 +76,10 @@ GrapleCheckExperimentCompletion <- function(submissionURL, experimentId)
{
qurl <- paste(submissionURL, "GrapleRunStatus", experimentId, sep="/")
status<- getURL(qurl)
return (status)
return (fromJSON(status))
}

#' @title Gets the Graple Experiment Results
#' @title Gets the GRAPLEr Experiment Results
#' @description
#' This function allows you to retrieve the complete results
#' of an experiment.
Expand Down Expand Up @@ -227,7 +227,7 @@ GrapleRunExperimentJob <- function(submissionURL, simDir, FilterName)
return (expid)
}

#' @title Gets the Graple Experiment Job Results
#' @title Gets the GRAPLEr Experiment Job Results
#' @description
#' This function allows you to retrieve the complete results
#' of an sweep job style experiment.
Expand Down Expand Up @@ -263,3 +263,26 @@ GrapleGetExperimentJobResults <- function(submissionURL, experimentId)
setwd(td)
return(resultfile)
}

#' @title Aborts an existing GRAPLE experiment
#' @description
#' This function allows you to terminate a previously submitted experiment using
#' its experiment identifier. This is useful for aborting stalled or failed experiments.
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param experimentId Experiment ID returned from GrapleRunExperiment
#' or GrapleRunExperimentSweep
#' @return a status string
#' @keywords Graple AbortExperiment
#' @export
#' @examples
#' \dontrun{
#' graplerURL<-"http://graple-service.cloudapp.net"
#' expId<-"7YWMJYAYAR7Y3TNTAKC5801KMN7JHQW8NYBDMKUR"
#' GrapleAbortExperiment(graplerURL, expId)
#' }
GrapleAbortExperiment <- function(submissionURL, experimentId)
{
qurl <- paste(submissionURL, "GrapleAbort", experimentId, sep="/")
status<- getURL(qurl)
return (fromJSON(status))
}
31 changes: 31 additions & 0 deletions man/GrapleAbortExperiment.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions test/testGrapleR.R
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
#install_github("GRAPLE/GrapleR")
library("bitops")
library("RCurl")
library("jsonlite")
library('GLMr')
library("glmtools")
library("GRAPLEr")

graplerURL<-"http://graple.acis.ufl.edu"
#graplerURL<-"http://graple-service.cloudapp.net"
print(GrapleCheckService(graplerURL))

#Experiment 1
expRootDir<-"c:/ExpRoot/Exp1"
setwd(expRootDir)

expId1<-GrapleRunExperiment(graplerURL, expRootDir)
GrapleCheckExperimentCompletion(graplerURL, expId1)
GrapleGetExperimentResults(graplerURL, expId1)

GrapleAbortExperiment(graplerURL, expId1)

#Experiment 2 - w/ Filter
expRootDir<-"c:/ExpRoot/Exp2"
filterName <- "Filter1.R"
setwd(expRootDir)

expId2<-GrapleRunExperiment(graplerURL, expRootDir, filterName)
GrapleCheckExperimentCompletion(graplerURL, expId2)
GrapleGetExperimentResults(graplerURL, expId2)
Expand Down Expand Up @@ -66,3 +64,10 @@ setwd(simDir6)
expId6<-GrapleRunExperimentJob(graplerURL, simDir6, filterName)
GrapleCheckExperimentCompletion(graplerURL, expId6)
GrapleGetExperimentJobResults(graplerURL, expId6)

#Experiment 7
expRootDir<-"c:/ExpRoot/Exp1"
setwd(expRootDir)
expId1<-GrapleRunExperiment(graplerURL, expRootDir)
GrapleCheckExperimentCompletion(graplerURL, expId1)
GrapleAbortExperiment(graplerURL, expId1)

0 comments on commit 11ed370

Please sign in to comment.