Mercurial > repos > patrick_chabrier > carboseq_s
comparison run.r @ 11:32bda6e69c5a draft default tip
Uploaded
author | patrick_chabrier |
---|---|
date | Thu, 11 Jul 2024 09:40:46 +0000 |
parents | 74a8deeedd19 |
children |
comparison
equal
deleted
inserted
replaced
10:28139f7f1dbc | 11:32bda6e69c5a |
---|---|
3 # Function to parse command-line arguments | 3 # Function to parse command-line arguments |
4 parse_args <- function() { | 4 parse_args <- function() { |
5 args <- commandArgs(trailingOnly = TRUE) | 5 args <- commandArgs(trailingOnly = TRUE) |
6 | 6 |
7 # Default values for optional parameters | 7 # Default values for optional parameters |
8 # url <- "https://coby.infosol.inrae.fr:8080/semantify/" | 8 url <- "https://coby.infosol.inrae.fr:8080/semantify/" |
9 url <- "http://localhost:8282/semantify" | |
10 srcDir <- NULL | 9 srcDir <- NULL |
11 part <- "modeltoolbox_sem_sep" | 10 part <- "modeltoolbox_sem_sep" |
12 DS <- T | 11 DS <- T |
13 NBCores <- 1 | 12 NBCores <- 1 |
14 # Parse arguments | 13 # Parse arguments |
34 } | 33 } |
35 | 34 |
36 if (grepl("^--srcOut=", arg)) { | 35 if (grepl("^--srcOut=", arg)) { |
37 srcOut <- sub("^--srcOut=", "", arg) | 36 srcOut <- sub("^--srcOut=", "", arg) |
38 } | 37 } |
38 | |
39 if (grepl("^--semPath=", arg)) { | |
40 semPath <- sub("^--semPath=", "", arg) | |
41 } | |
39 | 42 |
40 } | 43 } |
41 | 44 |
42 list(url = url, srcDir = srcDir, part = part, DS = DS, NBCores = NBCores, srcOut = srcOut) | 45 list(url = url, srcDir = srcDir, part = part, DS = DS, NBCores = NBCores, srcOut = srcOut, semPath = semPath) |
43 } | 46 } |
44 | 47 |
45 argus <- parse_args() | 48 argus <- parse_args() |
46 url <- argus[["url"]] | 49 url <- argus[["url"]] |
47 srcDir <- argus[["srcDir"]] | 50 srcDir <- argus[["srcDir"]] |
48 part <- argus[["part"]] | 51 part <- argus[["part"]] |
49 DS <- argus[["DS"]] | 52 DS <- argus[["DS"]] |
50 NBCores <- argus[["NBCores"]] | 53 NBCores <- argus[["NBCores"]] |
51 | 54 |
52 srcOut <- argus[["srcOut"]] | 55 srcOut <- argus[["srcOut"]] |
56 semPath <- argus[["semPath"]] | |
53 | 57 |
54 if (!endsWith(srcOut, "/")) { | 58 if (!endsWith(srcOut, "/")) { |
55 srcOut <- paste0(srcOut, "/") | 59 srcOut <- paste0(srcOut, "/") |
56 } | 60 } |
57 | 61 |
79 | 83 |
80 if (part == "modeltoolbox_sem_sep") { | 84 if (part == "modeltoolbox_sem_sep") { |
81 DS <- F | 85 DS <- F |
82 print("Setting DS to F. Will semantify outside of the csoprapreprocessor functions") | 86 print("Setting DS to F. Will semantify outside of the csoprapreprocessor functions") |
83 f0 <- function(){ | 87 f0 <- function(){ |
84 # path <- this.path::this.dir() | |
85 # print(path) | |
86 # setwd(path) | |
87 # setwd("../..") | |
88 print("before semantify") | |
89 # Sys.sleep(runif(n=1, min=30, max=60)) | |
90 csopratools::semantify( | 88 csopratools::semantify( |
91 inputDir = srcDir, | 89 inputDir = srcDir, |
92 outputDir = srcDir, | 90 outputDir = srcDir, |
93 name = "carboseq", | 91 name = "carboseq", |
94 use = "service", | 92 # use = "service", |
95 URL = url, | 93 URL = url, |
96 # extFileNames = paste0(c("crop", "soil", "units"), ".csv") | 94 use = "java", |
97 extFileNames = list.files(srcDir) | 95 semantifierRootPath = semPath, |
96 extFileNames = paste0(c("crop", "soil", "units"), ".csv") | |
98 ) | 97 ) |
99 print("between semantify and load") | 98 print("between semantify and load") |
100 modeltoolbox::loadCSVs(maxCores = NBCores, cinputCalculator = "cinest", | 99 modeltoolbox::loadCSVs(maxCores = NBCores, cinputCalculator = "cinest", |
101 preprocessorInputs = ppi) | 100 preprocessorInputs = ppi) |
102 print("between load an sim") | 101 print("between load an sim") |