comparison ogc_api_processes_wrapper.R @ 2:bcb6009d5af7 draft default tip

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/ogc_api_processes_wrapper commit e03f4d27ec44d873aacdf406d7a26ec8038e9b05
author ecology
date Wed, 08 May 2024 21:05:47 +0000
parents f6288dd4b77a
children
comparison
equal deleted inserted replaced
1:099d42f5804c 2:bcb6009d5af7
3 library("getopt") 3 library("getopt")
4 4
5 cat("start generic wrapper service \n") 5 cat("start generic wrapper service \n")
6 6
7 getParameters <- function(){ 7 getParameters <- function(){
8 args <- commandArgs(trailingOnly = TRUE)
9 con <- file("inputs.json", "r") 8 con <- file("inputs.json", "r")
10 line <- readLines(con, n = 1) 9 line <- readLines(con, n = 1)
11 json <- fromJSON(line) 10 json <- fromJSON(line)
12 close(con) 11 close(con)
13 return(json$conditional_process) 12 return(json$conditional_process)
110 result <- getResult(server, jobID) 109 result <- getResult(server, jobID)
111 if (result$status_code == 200) { 110 if (result$status_code == 200) {
112 resultBody <- parseResponseBody(result$body) 111 resultBody <- parseResponseBody(result$body)
113 urls <- unname(unlist(lapply(resultBody, function(x) x$href))) 112 urls <- unname(unlist(lapply(resultBody, function(x) x$href)))
114 urls_with_newline <- paste(urls, collapse = "\n") 113 urls_with_newline <- paste(urls, collapse = "\n")
115 sink(paste0(outputData, "_result_urls.txt")) 114 con <- file(outputData, "w")
116 cat(urls_with_newline, "\n") 115 writeLines(urls_with_newline, con = con)
117 sink() 116 close(con)
118 } 117 }
119 } else if (jobStatus == "failed") { 118 } else if (jobStatus == "failed") {
120 status <- jobStatus 119 status <- jobStatus
121 } 120 }
122 Sys.sleep(3) 121 Sys.sleep(3)
139 138
140 server <- "https://ospd.geolabs.fr:8300/ogc-api/" 139 server <- "https://ospd.geolabs.fr:8300/ogc-api/"
141 140
142 inputParameters <- getParameters() 141 inputParameters <- getParameters()
143 142
144 outputLocation <- inputParameters$outputData 143 args <- commandArgs(trailingOnly = TRUE)
144 outputLocation <- args[2]
145 145
146 outputs <- getOutputs(inputParameters, outputLocation, server) 146 outputs <- getOutputs(inputParameters, outputLocation, server)
147 147
148 for (key in names(inputParameters)) { 148 for (key in names(inputParameters)) {
149 print(inputParameters[[key]]) 149 print(inputParameters[[key]])