Skip to content

Commit

Permalink
Updates towards v1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
kcratie committed Feb 12, 2016
2 parents 9a6be00 + 11ed370 commit 673b700
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 70 deletions.
16 changes: 9 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
Package: GrapleR
Title: Graple Webservice Interface for R
Version: 15.6.0.8
Package: GRAPLEr
Title: Distributed computing made easy for lake ecology modeling
Version: 1.0.0
Authors@R: c(person("Ken", "S", role = c("aut", "cre"),
email = "[email protected]"),
person("Renato", "F", role = "cph"),
person("Saumitra", "A", role = "ctb",
email = "[email protected]"))
Description: What the package does (one paragraph)
email = "[email protected]"))
Description: GRAPLEr brings the power of distributing computing to the fingertips of lake ecology modelers. It is an R Package for connecting to the GRAPLE Web Service (GWS) and running GRAPLE jobs. Experiments consisting of thousands of simulations can be evaluated in a fraction of the time by submitting batches of GLM (General Lake Model) simulations to a distributed computing system, directly from your R/RStudio environment.
Depends:
R (>= 3.1.3)
Imports:
bitops,
ncdf,
RCurl,
glmtools
GLMr,
glmtools,
License: GPL-3
URL: https://github.com/Graple/grapler
URL: http://graple.github.io/
LazyData: true
RoxygenNote: 5.0.1
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
77 changes: 53 additions & 24 deletions R/GrapleR.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

.onAttach <- function(libname, pkgname) {
packageStartupMessage("This information is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science.")
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 GrapeR service.
#' @param submissionURL URL:Port of the GrapeR service
#' This function allows you to check the staus of the GRAPLEr web service.
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @return a string describing service status
#' @keywords Graple ServiceStatus
#' @export
Expand All @@ -21,17 +21,17 @@ GrapleCheckService<-function(submissionURL)
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 service
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param ExperimentDir the experiment root folder
#' @param FilterName the name of the post-processing filter script
#' @keywords Graple RunExperiment
#' @export
#' @examples
#' \dontrun{
#' graplerURL<-"http://128.227.150.20:80"
#' expRootDir<-"./Workspace/SimRoot"
#' graplerURL<-"http://graple-service.cloudapp.net"
#' expRootDir<-"./Workspace/ExpRoot"
#' filterName<-"Filter1.R"
#' GrapleRunExperiment(graplerURL, expRootDir, filterName)
#' }
Expand All @@ -57,18 +57,18 @@ 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 service.
#' @param submissionURL URL:Port of the GrapleR service
#' This function allows you to check the staus of the GRAPLEr web service.
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param experimentId Experiment ID returned from GrapleRunExperiment
#' or GrapleRunExperimentSweep
#' @return a string describing experiment status
#' @keywords Graple CheckExperimentCompletion
#' @export
#' @examples
#' \dontrun{
#' graplerURL<-"http://128.227.150.20:80"
#' graplerURL<-"http://graple-service.cloudapp.net"
#' expId<-"7YWMJYAYAR7Y3TNTAKC5801KMN7JHQW8NYBDMKUR"
#' GrapleCheckExperimentCompletion(graplerURL, expId)
#' }
Expand All @@ -79,24 +79,25 @@ GrapleCheckExperimentCompletion <- function(submissionURL, experimentId)
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.
#' @param submissionURL URL:Port of the GrapleR service
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param experimentId Experiment ID returned from GrapleRunExperiment
#' or GrapleRunExperimentSweep
#' @return a string describing the fully qualified result file name
#' @keywords Graple GetExperimentResults
#' @export
#' @examples
#' \dontrun{
#' graplerURL<-"http://128.227.150.20:80"
#' graplerURL<-"http://graple-service.cloudapp.net"
#' expId<-"7YWMJYAYAR7Y3TNTAKC5801KMN7JHQW8NYBDMKUR"
#' GrapleGetExperimentResults(graplerURL, expId)
#' }
GrapleGetExperimentResults <- function(submissionURL, experimentId)
{
td<-getwd()
qurl <- paste(submissionURL, "GrapleRunResults", experimentId, sep="/")
status<- getURL(qurl)

Expand All @@ -111,14 +112,15 @@ GrapleGetExperimentResults <- function(submissionURL, experimentId)
file.remove("results.tar.gz")
files <- list.files(".")
lapply(files, function(x){untar(x); file.remove(x)})
setwd(td)
return(resultfile)
}

#' @title Creates an experiment based on sweep parameters
#' @description
#' This function allows you to run an experiment using a single simulation.
#' The sweep parameters are used to generate the other sims.
#' @param submissionURL URL:Port of the GrapeR service
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param simDir the simulation folder containing the driver file
#' @param driverFileName the driver file name
#' @param parameterName the column name from the driver file to be swept
Expand All @@ -131,7 +133,7 @@ GrapleGetExperimentResults <- function(submissionURL, experimentId)
#' @export
#' @examples
#' \dontrun{
#' simDir="C:/Workspace/SimRoot/Sim0"
#' simDir="./Workspace/ExpRoot/Exp0"
#' driverFileName="met_hourly.csv"
#' parameterName="AirTemp"
#' startValue=-2
Expand Down Expand Up @@ -188,15 +190,15 @@ GrapleRunExperimentSweep <- function(submissionURL, simDir, driverFileName, para
#' Parametername1, add, uniform, -1, 1
#' Paramtername2, sub, binomial, 10, 0.5

#' @param submissionURL URL:Port of the GrapleR service
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param simDir the simulation folder containing the driver file
#' @param FilterName the name of post-process filter
#' @return the experiment ID
#' @keywords Graple RunExperimentJob
#' @export
#' @examples
#' \dontrun{
#' simDir="C:/Workspace/SimRoot"
#' simDir="./Workspace/ExpRoot/Exp0"
#' FilterName="Filter1.R"
#' expId<-GrapleRunExperimentJob(graplerURL, simDir, FilterName)
#' }
Expand All @@ -219,30 +221,33 @@ GrapleRunExperimentJob <- function(submissionURL, simDir, FilterName)
status <- postForm(qurl, files=fileUpload(tarfile))
if (file.exists(tarfile)) file.remove(tarfile)
unlink("../tempGRAPLE", recursive = TRUE)

print(fromJSON(status))
expid <- substr(status[1], start=57, stop=96)
setwd(td)

pid <- substr(status[1], start=57, stop=96)
setwd(td)
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.
#' @param submissionURL URL:Port of the GrapeR service
#' @param submissionURL URL:Port of the GRAPLEr web service
#' @param experimentId Experiment ID returned from GrapleRunExperiment
#' or GrapleRunExperimentSweep
#' @return a string describing the fully qualified result file name
#' @keywords Graple GetExperimentJobResults
#' @export
#' @examples
#' \dontrun{
#' graplerURL<-"http://128.227.150.20:80"
#' graplerURL<-"http://graple-service.cloudapp.net"
#' expId<-"7YWMJYAYAR7Y3TNTAKC5801KMN7JHQW8NYBDMKUR"
#' GrapleGetExperimentJobResults(graplerURL, expId)
#' }
GrapleGetExperimentJobResults <- function(submissionURL, experimentId)
{
td<-getwd()
qurl <- paste(submissionURL, "GrapleRunResultsMetSample", experimentId, sep="/")
status<- getURL(qurl)

Expand All @@ -257,5 +262,29 @@ GrapleGetExperimentJobResults <- function(submissionURL, experimentId)
file.remove("results.tar.gz")
files <- list.files(".", pattern = "\\.bz2\\.tar$")
lapply(files, function(x){untar(x); file.remove(x)})
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.

6 changes: 3 additions & 3 deletions man/GrapleCheckExperimentCompletion.Rd

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

4 changes: 2 additions & 2 deletions man/GrapleCheckService.Rd

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

4 changes: 2 additions & 2 deletions man/GrapleGetExperimentJobResults.Rd

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

4 changes: 2 additions & 2 deletions man/GrapleGetExperimentResults.Rd

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

6 changes: 3 additions & 3 deletions man/GrapleRunExperiment.Rd

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

4 changes: 2 additions & 2 deletions man/GrapleRunExperimentJob.Rd

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

Loading

0 comments on commit 673b700

Please sign in to comment.