Skip to content

Commit

Permalink
debug push
Browse files Browse the repository at this point in the history
  • Loading branch information
sambaala committed Mar 13, 2020
1 parent b24d683 commit 6613a0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion R/fromSource.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ composeFromSource<-function(file="acumos.R",
dir <- tempfile("acumos-tmp")
dir.create(dir)
on.exit(unlink(dir, TRUE))
file.link(file,file.path(dir,"component.R"))
file.copy(file,file.path(dir,"component.R"))
if(addSource) zip(zipfile = outputfile, files = file.path(dir,"component.R"), extras = "-j")
}

Expand Down
13 changes: 9 additions & 4 deletions R/run.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,21 @@ push <- function(url, file="component.amc", token, create=TRUE, license, headers
payload <- file.path(dir, "component.bin")
proto <- file.path(dir, "component.proto")
addSource<-file.exists(file.path(dir, "component.R"))
if(addSource) rfile <- file.path(dir, "component.R")
if(addSource){
source <- upload_file(file.path(dir, "component.R"), type = "text/plain; charset=UTF-8")
}else{
source <- NULL
}
headers <- if (missing(headers)) list() else as.list(headers)
headers[["Content-Type"]] <- "multipart/form-data"
headers[["isCreateMicroservice"]] <- if (isTRUE(create)) "true" else "false"
if (!missing(token)) headers$Authorization <- token
body <- c(list(
body <- list(
metadata = upload_file(metadata, type = "application/json; charset=UTF-8"),
schema = upload_file(proto, type = "text/plain; charset=UTF-8"),
model = upload_file(payload, type = "application/octet")),
source = c(NULL,upload_file(rfile, type = "text/plain; charset=UTF-8"))[addSource])
model = upload_file(payload, type = "application/octet"),
source = source)
body <- body[!sapply(body, is.null)]
aux <- list(...)
if (length(names(aux))) for (i in names(aux)) body[[i]] <- aux[[i]]
if (!missing(license)) {
Expand Down

0 comments on commit 6613a0c

Please sign in to comment.