Skip to content

Commit

Permalink
install Ronaldo on jupyter docker, add automation test and include ex…
Browse files Browse the repository at this point in the history
…ample use case (#575)
  • Loading branch information
vkumra-broad authored Sep 17, 2018
1 parent 68ed558 commit ce817e0
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ class NotebookRKernelSpec extends ClusterFixtureSpec {
}
}

"should have Ronaldo automatically installed" in { clusterFixture =>
withWebDriver { implicit driver =>
withNewNotebook(clusterFixture.cluster, RKernel) { notebookPage =>
notebookPage.executeCell(""""Ronaldo" %in% installed.packages()""") shouldBe Some("TRUE")
}
}
}
}

}
61 changes: 61 additions & 0 deletions example-notebooks/RonaldoExample.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook shows how the Ronaldo package can be use to get the service account key for the Leonardo user. The getServiceAccountKey function uses SAM to get the key for the service account associated with the user."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"key <- Ronaldo::getServiceAccountKey()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This key can be used to access resources associated with the Leonardo notebook user. In this example we can use the key to access bigquery data. The following command sets the service token which configures the bigquery library to access data that is available to the user."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"library(bigrquery)\n",
"set_service_token(key)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.4.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
1 change: 1 addition & 0 deletions jupyter-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ RUN R -e 'install.packages(c( \
"bigrquery", \
"tidyverse"), \
repos="http://cran.mtu.edu")' \
&& R -e 'devtools::install_github("DataBiosphere/Ronaldo")' \
&& R -e 'devtools::install_github("IRkernel/IRkernel")' \
&& R -e 'IRkernel::installspec(user=FALSE)' \
&& chown -R $USER:users /home/jupyter-user/.local \
Expand Down

0 comments on commit ce817e0

Please sign in to comment.