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

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  Bump version to 0.2.13
  Code indenting
  Fix typo in check if exportenv is loaded #117
  Refactor code for readability.  Add warning if packages didn't copy correctly. #107
  • Loading branch information
andrie committed Aug 19, 2016
2 parents 86600cd + 57a3572 commit cba95d0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 23 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Title: Interface with Azure Machine Learning Datasets, Experiments and Web Servi
Description: Functions and datasets to support Azure Machine Learning. This
allows you to interact with datasets, as well as publish and consume R functions
as API services.
Version: 0.2.12
Date: 2016-07-13
Version: 0.2.13
Date: 2016-08-19
Authors@R: c(
person("Andrie", "de Vries", role=c("aut", "cre"), email="[email protected]"),
person(family="Microsoft Corporation", role="cph"),
Expand Down
38 changes: 38 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
AzureML v0.2.13
---------------

Fixes:

* Fixes a bug that lead to a memory leak on the AzureML web service during consume(). Load exportenv only once (during first call) # 117


AzureML v0.2.12
---------------

This version was released to CRAN on 2017-07-12

Fixes:

* Upload packages from a local repository using `publishWebservice()` #109

Enhancements

* Produce more informative error messages from consume() (#57)
* Better documentation and examples for endpoint settings, especially for regional AML instances (#105)

This version also contains many other internal improvements that probably won't be visible to most users


AzureML v0.2.11 Bug fix and refactor release
---------------

This release fixes multiple internal issues:

* Add additional skip logic to skip tests on CRAN and if no Internet connection tests (#114)
* Fix unit tests and code for download.datasets() to deal with multiple datasets bug tests (#111)
* Upload packages from a local repository using `publishWebservice()` enhancement (#109)
* Missing workspace parameter on download.datasets() leads to cryptic error message bug (#93)
* Fix bug where example for download.datasets() doesn't work (#104)



39 changes: 25 additions & 14 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ zipNotAvailableMessage = "Requires external zip utility. Please install zip, ens
#' @importFrom base64enc base64encode
#' @importFrom miniCRAN makeRepo pkgDep
# @keywords Internal
packageEnv <- function(exportenv = new.env(), packages=NULL, version = "3.1.0") {
packageEnv <- function(exportenv = new.env(), packages=NULL, version = getOption("default_r_version")) {
if(!zipAvailable()) stop(zipNotAvailableMessage)

if(!is.null(packages)) assign("..packages", packages, envir = exportenv)
Expand All @@ -181,20 +181,31 @@ packageEnv <- function(exportenv = new.env(), packages=NULL, version = "3.1.0")
# Package up dependencies
if(!is.null(packages))
{
re = getOption("repos")
if(is.null(re)) re = c(CRAN = "http://cran.revolutionanalytics.com")
tp = file.path(td,"packages", fsep = "/")
re <- getOption("repos")
if(is.null(re)){
re <- c(CRAN = "http://cran.revolutionanalytics.com")
}
tp <- normalizePath(file.path(td, "packages"), winslash = "/", mustWork = FALSE)
tryCatch(dir.create(tp), warning = function(e) stop(e))
tryCatch(makeRepo(pkgDep(packages,
repos = re,
type = "win.binary",
Rversion = version,
suggests = FALSE),
path = tp,
repos = re,
type = "win.binary",
Rversion = version),
error=function(e) stop(e))
all_p <- pkgDep(packages,
repos = re,
type = "win.binary",
Rversion = version,
suggests = FALSE
)
tryCatch(
z <- makeRepo(all_p,
path = tp,
repos = re,
type = "win.binary",
Rversion = version
),
error=function(e) stop(e)
)
if(!all(grepl(tp, z))) {
warning("Packages did not copy properly in to AzureML. Please ensure you have miniCRAN v0.2.7 or above installed.")
}
z
}

z = try({
Expand Down
2 changes: 1 addition & 1 deletion R/publish.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ publishWebService <- function(ws, fun, name,
}

}

### Get and encode the dependencies

if(missing(packages)) packages=NULL
Expand Down
13 changes: 7 additions & 6 deletions R/wrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
### --- Do not remove this uncommented code ------------------------------------

# wrapperFunction <- function(){
# inputDF <- maml.mapInputPort(1)
#
# if(!is.element("exportenv ",search())) {
# inputDF <- maml.mapInputPort(1)
#
# if(!is.element("exportenv", search())) {
# load('src/env.RData')
# if(!is.null(exportenv$..packages)) {
# lapply(exportenv$..packages, function(pkg){
Expand All @@ -48,10 +49,10 @@
# quietly = TRUE, character.only=TRUE)
# }
# parent.env(exportenv) = globalenv()
#
#
# attach(exportenv, warn.conflicts = FALSE)
# }
#
#
# if(..data.frame){
# outputDF <- as.data.frame(..fun(inputDF))
# colnames(outputDF) <- ..output_names
Expand All @@ -62,7 +63,7 @@
# outputDF <- as.data.frame(outputDF)
# names(outputDF) <- ..output_names
# for(i in 1:nrow(inputDF)){
# outputDF[i, ] <- do.call('..fun', inputDF[i, ])
# outputDF[i, ] <- do.call(..fun, inputDF[i, ])
# }
# }
# maml.mapOutputPort("outputDF")
Expand All @@ -73,7 +74,7 @@

### --- End of Do not remove ---------------------------------------------------

wrapper <- "inputDF <- maml.mapInputPort(1)\nif (!is.element(\"exportenv \", search())) {\n load(\"src/env.RData\")\n if (!is.null(exportenv$..packages)) {\n lapply(exportenv$..packages, function(pkg) {\n if (!require(pkg, character.only = TRUE, quietly = TRUE)) \n install.packages(pkg, repos = paste0(\"file:///\", getwd(), \"/src/packages\"), lib = getwd())\n })\n .libPaths(new = getwd())\n lapply(exportenv$..packages, require, quietly = TRUE, character.only = TRUE)\n }\n parent.env(exportenv) = globalenv()\n attach(exportenv, warn.conflicts = FALSE)\n}\nif (..data.frame) {\n outputDF <- as.data.frame(..fun(inputDF))\n colnames(outputDF) <- ..output_names\n} else {\n outputDF <- matrix(nrow = nrow(inputDF), ncol = length(..output_names))\n outputDF <- as.data.frame(outputDF)\n names(outputDF) <- ..output_names\n for (i in 1:nrow(inputDF)) {\n outputDF[i, ] <- do.call(\"..fun\", inputDF[i, ])\n }\n}\nmaml.mapOutputPort(\"outputDF\")"
wrapper <- "inputDF <- maml.mapInputPort(1)\nif (!is.element(\"exportenv\", search())) {\n load(\"src/env.RData\")\n if (!is.null(exportenv$..packages)) {\n lapply(exportenv$..packages, function(pkg) {\n if (!require(pkg, character.only = TRUE, quietly = TRUE)) \n install.packages(pkg, repos = paste0(\"file:///\", getwd(), \"/src/packages\"), lib = getwd())\n })\n .libPaths(new = getwd())\n lapply(exportenv$..packages, require, quietly = TRUE, character.only = TRUE)\n }\n parent.env(exportenv) = globalenv()\n attach(exportenv, warn.conflicts = FALSE)\n}\nif (..data.frame) {\n outputDF <- as.data.frame(..fun(inputDF))\n colnames(outputDF) <- ..output_names\n} else {\n outputDF <- matrix(nrow = nrow(inputDF), ncol = length(..output_names))\n outputDF <- as.data.frame(outputDF)\n names(outputDF) <- ..output_names\n for (i in 1:nrow(inputDF)) {\n outputDF[i, ] <- do.call(..fun, inputDF[i, ])\n }\n}\nmaml.mapOutputPort(\"outputDF\")"



Expand Down

0 comments on commit cba95d0

Please sign in to comment.