From 11ed37061681f1327ec7f3d4278f05977ed9bd23 Mon Sep 17 00:00:00 2001 From: kcratie Date: Thu, 11 Feb 2016 20:17:52 -0500 Subject: [PATCH] Added Abort Experiment to package --- NAMESPACE | 1 + R/GrapleR.R | 37 +++++++++++++++++++++++++++++------- man/GrapleAbortExperiment.Rd | 31 ++++++++++++++++++++++++++++++ test/testGrapleR.R | 13 +++++++++---- 4 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 man/GrapleAbortExperiment.Rd diff --git a/NAMESPACE b/NAMESPACE index 803dc13..afa2eba 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(GrapleAbortExperiment) export(GrapleCheckExperimentCompletion) export(GrapleCheckService) export(GrapleGetExperimentJobResults) diff --git a/R/GrapleR.R b/R/GrapleR.R index f2a5513..c2a99d6 100644 --- a/R/GrapleR.R +++ b/R/GrapleR.R @@ -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 @@ -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 @@ -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 @@ -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. @@ -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. @@ -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)) +} diff --git a/man/GrapleAbortExperiment.Rd b/man/GrapleAbortExperiment.Rd new file mode 100644 index 0000000..746d316 --- /dev/null +++ b/man/GrapleAbortExperiment.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/GrapleR.R +\name{GrapleAbortExperiment} +\alias{GrapleAbortExperiment} +\title{Aborts an existing GRAPLE experiment} +\usage{ +GrapleAbortExperiment(submissionURL, experimentId) +} +\arguments{ +\item{submissionURL}{URL:Port of the GRAPLEr web service} + +\item{experimentId}{Experiment ID returned from GrapleRunExperiment +or GrapleRunExperimentSweep} +} +\value{ +a status string +} +\description{ +This function allows you to terminate a previously submitted experiment using +its experiment identifier. This is useful for aborting stalled or failed experiments. +} +\examples{ +\dontrun{ +graplerURL<-"http://graple-service.cloudapp.net" +expId<-"7YWMJYAYAR7Y3TNTAKC5801KMN7JHQW8NYBDMKUR" +GrapleAbortExperiment(graplerURL, expId) +} +} +\keyword{AbortExperiment} +\keyword{Graple} + diff --git a/test/testGrapleR.R b/test/testGrapleR.R index 657a114..2cf1e56 100644 --- a/test/testGrapleR.R +++ b/test/testGrapleR.R @@ -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) @@ -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)