Skip to content

Commit 6796d78

Browse files
committed
Fix benchmark report workspace links
1 parent 24b7a5b commit 6796d78

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

modules/local/benchmark_report/overrides/render_benchmark_report.R

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,27 @@ safe_sd <- function(x) {
8989
sd(x, na.rm = TRUE)
9090
}
9191

92+
build_workspace_run_url <- function(run_id, group, existing_url = "") {
93+
existing_url <- clean_scalar_chr(existing_url)
94+
group <- clean_scalar_chr(group)
95+
96+
base_url <- dplyr::if_else(
97+
grepl("^Batch", group, ignore.case = TRUE),
98+
"https://seqera.io/orgs/scidev/workspaces/testing/watch",
99+
"https://cloud.dev-seqera.io/orgs/unified-compute/workspaces/sched-testing"
100+
)
101+
102+
has_watch <- grepl("/watch/?$", base_url)
103+
run_path <- ifelse(has_watch, paste0("/", run_id), paste0("/watch/", run_id))
104+
fallback_url <- paste0(sub("/$", "", base_url), run_path)
105+
106+
dplyr::if_else(
107+
nzchar(existing_url) & !grepl("example\\.invalid", existing_url, ignore.case = TRUE),
108+
existing_url,
109+
fallback_url
110+
)
111+
}
112+
92113
build_cost_table <- function(task_data, merged_logs, aws_cost = NULL, remove_failed_tasks = FALSE) {
93114
accurate_task_costs <- data.frame()
94115
run_group_lookup <- merged_logs %>%
@@ -341,7 +362,11 @@ run_costs <- task_data_aug %>%
341362
)
342363

343364
workspace_values <- clean_scalar_chr(first_present(merged_logs, c("workspaceFullName", "workspaceName", "workspaceId"), ""))
344-
platform_urls <- clean_scalar_chr(first_present(merged_logs, c("runUrl"), ""))
365+
platform_urls <- build_workspace_run_url(
366+
run_id = clean_scalar_chr(merged_logs$run_id),
367+
group = clean_scalar_chr(merged_logs$group),
368+
existing_url = first_present(merged_logs, c("runUrl"), "")
369+
)
345370

346371
benchmark_overview <- merged_logs %>%
347372
transmute(

0 commit comments

Comments
 (0)