Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
169 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
httpget_session_stdout <- function(filepath, requri){ | ||
|
||
#load data | ||
myeval <- readRDS(sessionfile <- file.path(filepath, ".REval")); | ||
mymsg <- extract(myeval, "text"); | ||
|
||
#render | ||
reqformat <- requri[1]; | ||
httpget_object(mymsg, reqformat, "stdout", "text"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,79 @@ | ||
session <- local({ | ||
prefix = "ocpu_session_"; | ||
|
||
remove <- function(hash){ | ||
mydir <- sessiondir(hash); | ||
stopifnot(file.remove(mydir, recursive=TRUE)); | ||
} | ||
|
||
save <- function(hash, envir){ | ||
setwd(sessiondir(hash)); | ||
save(file=".RData", list=ls(envir), envir); | ||
} | ||
|
||
init <- function(){ | ||
characters <- c(0:9, letters[1:6]); | ||
hash <- paste(c("0x0", sample(characters, 7, replace=TRUE)), collapse="") | ||
stopifnot(dir.create(sessiondir(hash))); | ||
setwd(sessiondir(hash)); | ||
sessionpath(hash); | ||
} | ||
|
||
list <- function(filepath){ | ||
setwd(filepath); | ||
outlist <- vector(); | ||
|
||
#list data files | ||
if(file.exists(".RData")){ | ||
myenv <- new.env(); | ||
load(".RData", myenv); | ||
if(length(ls(myenv))){ | ||
outlist <- c(outlist, paste("R", ls(myenv), sep="/")); | ||
} | ||
} | ||
|
||
#list eval files | ||
if(file.exists(".REval")){ | ||
myeval <- readRDS(".REval"); | ||
if(length(extract(myeval, "graphics"))){ | ||
outlist <- c(outlist, paste("graphics", seq_along(extract(myeval, "graphics")), sep="/")); | ||
} | ||
if(length(extract(myeval, "message"))){ | ||
outlist <- c(outlist, "messages"); | ||
} | ||
if(length(extract(myeval, "warning"))){ | ||
outlist <- c(outlist, "warnings"); | ||
} | ||
if(length(extract(myeval, "source"))){ | ||
outlist <- c(outlist, "source"); | ||
} | ||
if(length(extract(myeval, "console"))){ | ||
outlist <- c(outlist, "console"); | ||
} | ||
#outlist <- c(outlist, "report"); | ||
} | ||
|
||
#list eval files | ||
if(file.exists(".RInfo")){ | ||
outlist <- c(outlist, "info"); | ||
} | ||
|
||
#other files | ||
if(length(list.files())){ | ||
outlist <- c(outlist, "files") | ||
} | ||
|
||
return(outlist); | ||
} | ||
|
||
sessiondir <- function(hash){ | ||
file.path(gettmpdir(), paste(prefix, hash, sep="")); | ||
} | ||
|
||
sessionpath <- function(hash){ | ||
paste("/tmp/", hash, sep=""); | ||
} | ||
|
||
environment(); | ||
}) | ||
|
||
session <- local({ | ||
prefix = "ocpu_session_"; | ||
|
||
remove <- function(hash){ | ||
mydir <- sessiondir(hash); | ||
stopifnot(file.remove(mydir, recursive=TRUE)); | ||
} | ||
|
||
save <- function(hash, envir){ | ||
setwd(sessiondir(hash)); | ||
save(file=".RData", list=ls(envir), envir); | ||
} | ||
|
||
init <- function(){ | ||
characters <- c(0:9, letters[1:6]); | ||
hash <- paste(c("0x0", sample(characters, 7, replace=TRUE)), collapse="") | ||
stopifnot(dir.create(sessiondir(hash))); | ||
setwd(sessiondir(hash)); | ||
sessionpath(hash); | ||
} | ||
|
||
list <- function(filepath){ | ||
setwd(filepath); | ||
outlist <- vector(); | ||
|
||
#list data files | ||
if(file.exists(".RData")){ | ||
myenv <- new.env(); | ||
load(".RData", myenv); | ||
if(length(ls(myenv, all.names=TRUE))){ | ||
outlist <- c(outlist, paste("R", ls(myenv, all.names=TRUE), sep="/")); | ||
} | ||
} | ||
|
||
#list eval files | ||
if(file.exists(".REval")){ | ||
myeval <- readRDS(".REval"); | ||
if(length(extract(myeval, "graphics"))){ | ||
outlist <- c(outlist, paste("graphics", seq_along(extract(myeval, "graphics")), sep="/")); | ||
} | ||
if(length(extract(myeval, "message"))){ | ||
outlist <- c(outlist, "messages"); | ||
} | ||
if(length(extract(myeval, "warning"))){ | ||
outlist <- c(outlist, "warnings"); | ||
} | ||
if(length(extract(myeval, "source"))){ | ||
outlist <- c(outlist, "source"); | ||
} | ||
if(length(extract(myeval, "console"))){ | ||
outlist <- c(outlist, "console"); | ||
} | ||
#outlist <- c(outlist, "report"); | ||
} | ||
|
||
#list eval files | ||
if(file.exists(".RInfo")){ | ||
outlist <- c(outlist, "info"); | ||
} | ||
|
||
#other files | ||
if(length(list.files())){ | ||
outlist <- c(outlist, "files") | ||
} | ||
|
||
return(outlist); | ||
} | ||
|
||
sessiondir <- function(hash){ | ||
file.path(gettmpdir(), paste(prefix, hash, sep="")); | ||
} | ||
|
||
sessionpath <- function(hash){ | ||
paste("/tmp/", hash, sep=""); | ||
} | ||
|
||
environment(); | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TO DO: | ||
|
||
request content-type: json | ||
add windows user stuff | ||
add file executors |