Spaces:
Sleeping
Sleeping
jedick
commited on
Commit
·
74d192d
1
Parent(s):
a665466
Move R session startup code to profile.R
Browse files- entrypoint.sh +2 -6
- profile.R +12 -0
entrypoint.sh
CHANGED
|
@@ -3,12 +3,8 @@
|
|
| 3 |
# Exit immediately on errors
|
| 4 |
set -e
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
| 8 |
-
cat > .Rprofile << 'EOF'
|
| 9 |
-
options(repos = c(CRAN = "https://cloud.r-project.org"))
|
| 10 |
-
library(tidyverse); source('data_summary.R'); mcptools::mcp_session()
|
| 11 |
-
EOF
|
| 12 |
|
| 13 |
# Start R in a detached screen session
|
| 14 |
# TODO: Look at using supervisord for another way to run multiple services
|
|
|
|
| 3 |
# Exit immediately on errors
|
| 4 |
set -e
|
| 5 |
|
| 6 |
+
# Use profile for persistent R session
|
| 7 |
+
cp profile.R .Rprofile
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Start R in a detached screen session
|
| 10 |
# TODO: Look at using supervisord for another way to run multiple services
|
profile.R
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Set a default CRAN mirror
|
| 2 |
+
options(repos = c(CRAN = "https://cloud.r-project.org"))
|
| 3 |
+
|
| 4 |
+
# Load a commonly used package
|
| 5 |
+
library(tidyverse)
|
| 6 |
+
|
| 7 |
+
# Use our own data summary function
|
| 8 |
+
source("data_summary.R")
|
| 9 |
+
|
| 10 |
+
# Make this R session visible to the mcptools MCP server
|
| 11 |
+
# NOTE: mcp_session() needs to be run in an *interactive* R session, so we can't put it in server.R
|
| 12 |
+
mcptools::mcp_session()
|