credential handling fixed
This commit is contained in:
Родитель
981ce28aad
Коммит
f61d92a74e
|
@ -79,10 +79,11 @@ p.caption ol,li {
|
|||
|
||||
|
||||
```{r echo=FALSE,warning=FALSE, results='hide',message=FALSE,message=FALSE}
|
||||
|
||||
library(knitr)
|
||||
knitr::opts_chunk$set( cache=FALSE,echo=FALSE,warning=FALSE,message=FALSE,eval=FALSE,fig.width=13,fig.height=4)
|
||||
source("query.R")
|
||||
#g <- bq()
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
|
|
@ -66,16 +66,19 @@ h3, .h3 {
|
|||
|
||||
|
||||
```{r echo=FALSE,warning=FALSE, message=FALSE}
|
||||
|
||||
library(knitr)
|
||||
knitr::opts_chunk$set( cache=FALSE,echo=FALSE,warning=FALSE,message=FALSE,eval=FALSE,fig.width=13,fig.height=4)
|
||||
source("query.R")
|
||||
g <- bq()
|
||||
|
||||
## args can have two params
|
||||
## args(max.build.id = starting buildid, default is computed from existing table,
|
||||
## end.build = ending.build , default is yesterday
|
||||
## )
|
||||
args <- params$args
|
||||
is.debug <- if(!is.null(args$debug)) args$debug else FALSE
|
||||
g <- bq(use_email=args$use_email)
|
||||
|
||||
#args <- list(max.build.id='2020-04-01')
|
||||
## is.debug <- TRUE
|
||||
```
|
||||
|
|
7
query.R
7
query.R
|
@ -28,8 +28,11 @@ if(!exists("query.R")){
|
|||
}
|
||||
|
||||
bq <- function(project = 'moz-fx-data-derived-datasets'
|
||||
,dataset = 'telemetry'){
|
||||
bq_auth(email='sguha@mozilla.com' ,use_oob =TRUE ) #path = "~/mz/confs/gcloud.json")
|
||||
,dataset = 'telemetry'
|
||||
,use_email = NULL
|
||||
){
|
||||
if(is.null(use_email)) bq_auth(email='sguha@mozilla.com' ,use_oob =TRUE ) #path = "~/mz/confs/gcloud.json")
|
||||
else bq_auth()
|
||||
ocon <- dbConnect(
|
||||
bigrquery::bigquery(),
|
||||
project = project,
|
||||
|
|
|
@ -5,6 +5,7 @@ sudo docker build -t ds_283_prod .
|
|||
```
|
||||
|
||||
We are good to go. Now for testing, I mount my `gargle` cached authentifications(and other google auths too) into the container and run it like so
|
||||
(you might not need sudo)
|
||||
|
||||
```
|
||||
|
||||
|
@ -12,6 +13,11 @@ sudo docker run -it -v ~/.R:/root/.R -v ~/.config:/root/.config ds_283_prod
|
|||
|
||||
```
|
||||
|
||||
if you have a service account, then
|
||||
|
||||
```
|
||||
sudo docker run -it -v PATH_TO_SERVICE_CREDENITIALS.json:/app/.credentials -e GOOGLE_APPLICATION_CREDENTIALS=/app/.credentials ds_283_prod
|
||||
```
|
||||
|
||||
|
||||
And that ought be it! The dashboard is copied to `gs://moz-fx-data-prod-analysis/sguha/ds_283/`.
|
||||
|
|
9
run.sh
9
run.sh
|
@ -1,5 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
Rscript -e "setwd('/webrender_intel_win10_nightly');library(rmarkdown); render('driver.Rmd');render('dashboard.Rmd',output_dir='/tmp/output/')"
|
||||
gsutil -m rsync -r -d /tmp/output/ gs://moz-fx-data-prod-analysis/sguha/ds_283/
|
||||
gsutil -m rsync -r /webrender_intel_win10_nightly/driver.html gs://moz-fx-data-prod-analysis/sguha/ds_283/
|
||||
BUCKET=moz-fx-data-prod-analysis
|
||||
gcloud auth activate-service-account --key-file /app/.credentials
|
||||
|
||||
Rscript -e "setwd('/webrender_intel_win10_nightly');library(rmarkdown); render('driver.Rmd',param=list(args=list(use_email=FALSE)));render('dashboard.Rmd',output_dir='/tmp/output/')"
|
||||
gsutil -m rsync -r -d /tmp/output/ gs://$BUCKET/sguha/ds_283/
|
||||
gsutil -m rsync -r /webrender_intel_win10_nightly/driver.html gs://$BUCKET/sguha/ds_283/
|
||||
|
|
Загрузка…
Ссылка в новой задаче