Skip to content

Commit b813d28

Browse files
committed
first endpoint draft
1 parent 1a862a8 commit b813d28

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
rm(list = ls())
2+
3+
args <- commandArgs(TRUE)
4+
wd <- args[1]
5+
setwd(wd) #Don't forget to set your working directory
6+
7+
renv::activate()
8+
renv::restore(lockfile = '../renv.lock')
9+
Sys.setlocale(category="LC_ALL", locale = "en_US.UTF-8")
10+
11+
library(jsonlite)
12+
library(logging)
13+
14+
source('utils.R')
15+
if (Sys.getenv("LOGLEVEL") == "DEBUG") {
16+
DEBUG <- FALSE
17+
} else {
18+
DEBUG <- TRUE
19+
}
20+
21+
if (DEBUG==TRUE){
22+
setup_logging('DEBUG')
23+
} else {
24+
setup_logging('INFO')
25+
}
26+
27+
28+
log <- getLogger('base_repos')
29+
30+
tryCatch({
31+
contentproviders <- bs_repositories("")
32+
}, error=function(err){
33+
log$error(paste("Contentprovider failed", "base", "retrieve_contentproviders", "", err, sep="||"))
34+
failed <- list()
35+
failed$reason <- list(err)
36+
failed$status <- 'error'
37+
})
38+
39+
40+
if (exists('contentproviders')) {
41+
print(toJSON(contentproviders))
42+
} else {
43+
print(toJSON(failed))
44+
}

server/workers/base/src/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def execute_search(self, params):
5252
self.logger.error(error)
5353
raise
5454

55-
def execute_contentproviders(self):
55+
def get_contentproviders(self):
56+
cmd = [self.command, "run_base_contentproviders.R", self.wd]
5657

5758
def run(self):
5859
while True:

0 commit comments

Comments
 (0)