From 2a8390cc524bcb2eba803536b02f6f083d388b9a Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Fri, 31 May 2024 15:57:57 +0200 Subject: [PATCH] prepare task result processors for viash 0.9 (#455) * prepare task result processors for viash 0.9 * remove assertion --- .../get_method_info/script.R | 30 ++++++++++++------- .../get_metric_info/script.R | 23 +++++++++----- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/common/process_task_results/get_method_info/script.R b/src/common/process_task_results/get_method_info/script.R index 59cf4bd52c..a332413b69 100644 --- a/src/common/process_task_results/get_method_info/script.R +++ b/src/common/process_task_results/get_method_info/script.R @@ -16,20 +16,28 @@ outputs <- map(configs, function(config) { if (length(config$functionality$status) > 0 && config$functionality$status == "disabled") { return(NULL) } - info <- config$functionality$info + + # prep for viash 0.9.0 + build_info <- config$build_info %||% config$info + if ("functionality" %in% names(config)) { + config[names(config$functionality)] <- config$functionality + config[["functionality"]] <- NULL + } + + info <- config$info # add extra info - info$config_path <- gsub(".*openproblems-v2/src/", "src/", config$info$config) - info$task_id <- gsub("/.*", "", config$functionality$namespace) - info$id <- config$functionality$name - info$namespace <- config$functionality$namespace - info$commit_sha <- config$info$git_commit %||% "missing-sha" + info$config_path <- gsub(".*/src/", "src/", build_info$config) + info$task_id <- gsub("/.*", "", config$namespace) + info$id <- config$name + info$namespace <- config$namespace + info$commit_sha <- build_info$git_commit %||% "missing-sha" info$code_version <- "missing-version" - info$implementation_url <- paste0( - "https://github.com/openproblems-bio/openproblems-v2/tree/", - info$commit_sha, "/", - info$config_path - ) + info$implementation_url <- paste0( + build_info$git_remote, "/blob/", + build_info$git_commit, "/", + info$config_path + ) # ↑ this could be used as the new format diff --git a/src/common/process_task_results/get_metric_info/script.R b/src/common/process_task_results/get_metric_info/script.R index c384892595..5ef8f6b04b 100644 --- a/src/common/process_task_results/get_metric_info/script.R +++ b/src/common/process_task_results/get_metric_info/script.R @@ -17,20 +17,27 @@ outputs <- map(configs, function(config) { return(NULL) } + # prep for viash 0.9.0 + build_info <- config$build_info %||% config$info + if ("functionality" %in% names(config)) { + config[names(config$functionality)] <- config$functionality + config[["functionality"]] <- NULL + } + map( - config$functionality$info$metrics, + config$info$metrics, function(info) { # add extra info - info$config_path <- gsub(".*openproblems-v2/src/", "src/", config$info$config) - info$task_id <- gsub("/.*", "", config$functionality$namespace) + info$config_path <- gsub(".*/src/", "src/", build_info$config) + info$task_id <- gsub("/.*", "", config$namespace) info$id <- info$name - info$component_id <- config$functionality$name - info$namespace <- config$functionality$namespace - info$commit_sha <- config$info$git_commit %||% "missing-sha" + info$component_id <- config$name + info$namespace <- config$namespace + info$commit_sha <- build_info$git_commit %||% "missing-sha" info$code_version <- "missing-version" info$implementation_url <- paste0( - "https://github.com/openproblems-bio/openproblems-v2/tree/", - info$commit_sha, "/", + build_info$git_remote, "/blob/", + build_info$git_commit, "/", info$config_path )