-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from A2-ai/get_job_fix
Get job fix
- Loading branch information
Showing
8 changed files
with
481 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,271 @@ | ||
here::here() | ||
devtools::check() | ||
devtools::check() | ||
here::here() | ||
devtools::check() | ||
here::here() | ||
library(here) | ||
install.packages("here") | ||
install.packages("devtools") | ||
devtools::check() | ||
install.packages("dplyr") | ||
install.packages("extendr") | ||
install.packages("rextendr") | ||
devtools::check() | ||
install.packages("bbr") | ||
devtools::check() | ||
as.POSIXct("2024-08-23 12:34:56") | ||
build_site() | ||
library(pkgdown) | ||
build_site() | ||
getwd() | ||
setwd("../scicalc") | ||
getwd() | ||
build_site() | ||
library(scicalc) | ||
getwd() | ||
library(pkgdown) | ||
sink("_pkgdown.yml") | ||
template_navbar() | ||
template_reference() | ||
sink() | ||
build_site() | ||
build_site() | ||
library(slurmtools) | ||
#removing generated files from running this vignette | ||
nonmem <- file.path("model", "nonmem") | ||
unlink(file.path(nonmem, "1001"), recursive = TRUE) | ||
unlink(file.path(nonmem, "1001.yaml")) | ||
unlink(file.path(nonmem, "1001.toml")) | ||
unlink(file.path(nonmem, "submission-log"), recursive = TRUE) | ||
unlink(file.path(nonmem, "in_progress"), recursive = TRUE) | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "" | ||
) | ||
library(slurmtools) | ||
options(repos = c( | ||
"slurmtools" = "https://a2-ai.github.io/gh-pkg-mirror/slurmtools", | ||
getOption("repos"))) | ||
install.packages("slurmtools") | ||
library(slurmtools) | ||
library(bbr) | ||
library(here) | ||
nonmem = file.path(here::here(), "vignettes", "model", "nonmem") | ||
options('slurmtools.submission_root' = file.path(nonmem, "submission-log")) | ||
mod_number <- "1001" | ||
if (file.exists(file.path(nonmem, paste0(mod_number, ".yaml")))) { | ||
mod <- bbr::read_model(file.path(nonmem, mod_number)) | ||
} else { | ||
mod <- bbr::new_model(file.path(nonmem, mod_number)) | ||
} | ||
submission <- slurmtools::submit_nonmem_model( | ||
mod, | ||
slurm_job_template_path = file.path(nonmem, "slurm-job-bbi.tmpl"), | ||
slurm_template_opts = list( | ||
bbi_exe_path = Sys.which("bbi"), | ||
bbi_config_path = file.path(nonmem, "bbi.yaml")) | ||
) | ||
submission | ||
submitted_job_id <- submission$stdout | ||
submitted_job_id <- strsplit(submitted_job_id, "\n")[[1]] | ||
submitted_job_id <- tail(strsplit(submitted_job_id, " ")[[1]], 1) | ||
slurmtools::get_slurm_jobs() %>% | ||
dplyr::filter(job_id == submitted_job_id) | ||
?tail | ||
?get_slurm_jobs | ||
get_slurm_jobs | ||
cmd <- list(cmd = "squeue", args = "--json") | ||
res <- processx::run(cmd$cmd, args = cmd$args) | ||
if (res$status != 0) { | ||
# todo: better handle returning why | ||
rlang::abort("unable to get slurm jobs, test what the output would be by running `squeue --json`") | ||
} | ||
res_df <- parse_jobs_json(jsonlite::fromJSON(res$stdout, simplifyVector = FALSE)) | ||
?parse_jobs_json | ||
??parse_jobs_json | ||
parse_jobs_json <- function(.json) { | ||
if (!length(.json$jobs)) { | ||
return(NULL) | ||
} | ||
purrr::list_rbind(purrr::map(.json$jobs, parse_job_to_row)) | ||
} | ||
res_df <- parse_jobs_json(jsonlite::fromJSON(res$stdout, simplifyVector = FALSE)) | ||
parse_job_to_row <- function(job) { | ||
tibble::tibble( | ||
job_id = job$job_id, | ||
job_state = job$job_state, | ||
cpus = job$cpus$number, | ||
partition = job$partition, | ||
standard_input = job$standard_input, | ||
standard_output = job$standard_output, | ||
submit_time = job$submit_time, | ||
start_time = job$start_time, | ||
user_name = job$user_name, | ||
current_working_directory = job$current_working_directory | ||
) | ||
} | ||
res_df <- parse_jobs_json(jsonlite::fromJSON(res$stdout, simplifyVector = FALSE)) | ||
res_df$submit_time | ||
class(res_df$submit_time) | ||
?as.POSIXct | ||
?jsonlite:::fromJSON | ||
as.POSIXct(res_df$submit_time$number, origin = "1970-01-01") | ||
res_df$start_time | ||
build_site() | ||
#removing generated files from running this vignette | ||
nonmem <- file.path("model", "nonmem") | ||
unlink(file.path(nonmem, "1001"), recursive = TRUE) | ||
unlink(file.path(nonmem, "1001.yaml")) | ||
unlink(file.path(nonmem, "1001.toml")) | ||
unlink(file.path(nonmem, "submission-log"), recursive = TRUE) | ||
unlink(file.path(nonmem, "in_progress"), recursive = TRUE) | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "" | ||
) | ||
library(slurmtools) | ||
library(bbr) | ||
library(here) | ||
nonmem = file.path(here::here(), "vignettes", "model", "nonmem") | ||
options('slurmtools.submission_root' = file.path(nonmem, "submission-log")) | ||
mod_number <- "1001" | ||
if (file.exists(file.path(nonmem, paste0(mod_number, ".yaml")))) { | ||
mod <- bbr::read_model(file.path(nonmem, mod_number)) | ||
} else { | ||
mod <- bbr::new_model(file.path(nonmem, mod_number)) | ||
} | ||
submission <- slurmtools::submit_nonmem_model( | ||
mod, | ||
slurm_job_template_path = file.path(nonmem, "slurm-job-bbi.tmpl"), | ||
slurm_template_opts = list( | ||
bbi_exe_path = Sys.which("bbi"), | ||
bbi_config_path = file.path(nonmem, "bbi.yaml")) | ||
) | ||
submission | ||
submitted_job_id <- submission$stdout | ||
submitted_job_id <- strsplit(submitted_job_id, "\n")[[1]] | ||
submitted_job_id <- tail(strsplit(submitted_job_id, " ")[[1]], 1) | ||
slurmtools::get_slurm_jobs() %>% | ||
dplyr::filter(job_id == submitted_job_id) | ||
open slurmtools::get_slurm_jobs() | ||
open(slurmtools::get_slurm_jobs()) | ||
open(slurmtools::get_slurm_jobs | ||
) | ||
squeue --version | ||
library(pkgdown) | ||
build_site() | ||
.Last.error | ||
library(slurmtools) | ||
#removing generated files from running this vignette | ||
nonmem <- file.path("model", "nonmem") | ||
unlink(file.path(nonmem, "1001"), recursive = TRUE) | ||
unlink(file.path(nonmem, "1001.yaml")) | ||
unlink(file.path(nonmem, "1001.toml")) | ||
unlink(file.path(nonmem, "submission-log"), recursive = TRUE) | ||
unlink(file.path(nonmem, "in_progress"), recursive = TRUE) | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "" | ||
) | ||
library(slurmtools) | ||
library(bbr) | ||
library(here) | ||
nonmem = file.path(here::here(), "vignettes", "model", "nonmem") | ||
options('slurmtools.submission_root' = file.path(nonmem, "submission-log")) | ||
mod_number <- "1001" | ||
if (file.exists(file.path(nonmem, paste0(mod_number, ".yaml")))) { | ||
mod <- bbr::read_model(file.path(nonmem, mod_number)) | ||
} else { | ||
mod <- bbr::new_model(file.path(nonmem, mod_number)) | ||
} | ||
submission <- slurmtools::submit_nonmem_model( | ||
mod, | ||
slurm_job_template_path = file.path(nonmem, "slurm-job-bbi.tmpl"), | ||
slurm_template_opts = list( | ||
bbi_exe_path = Sys.which("bbi"), | ||
bbi_config_path = file.path(nonmem, "bbi.yaml")) | ||
) | ||
submission | ||
submitted_job_id <- submission$stdout | ||
submitted_job_id <- strsplit(submitted_job_id, "\n")[[1]] | ||
submitted_job_id <- tail(strsplit(submitted_job_id, " ")[[1]], 1) | ||
slurmtools::get_slurm_jobs() %>% | ||
dplyr::filter(job_id == submitted_job_id) | ||
.libPaths() | ||
install.packages("~/packages/slurmtools", repos = NULL, type = "source") | ||
library(slurmtools) | ||
#removing generated files from running this vignette | ||
nonmem <- file.path("model", "nonmem") | ||
unlink(file.path(nonmem, "1001"), recursive = TRUE) | ||
unlink(file.path(nonmem, "1001.yaml")) | ||
unlink(file.path(nonmem, "1001.toml")) | ||
unlink(file.path(nonmem, "submission-log"), recursive = TRUE) | ||
unlink(file.path(nonmem, "in_progress"), recursive = TRUE) | ||
knitr::opts_chunk$set( | ||
collapse = TRUE, | ||
comment = "" | ||
) | ||
library(slurmtools) | ||
library(bbr) | ||
library(here) | ||
nonmem = file.path(here::here(), "vignettes", "model", "nonmem") | ||
options('slurmtools.submission_root' = file.path(nonmem, "submission-log")) | ||
mod_number <- "1001" | ||
if (file.exists(file.path(nonmem, paste0(mod_number, ".yaml")))) { | ||
mod <- bbr::read_model(file.path(nonmem, mod_number)) | ||
} else { | ||
mod <- bbr::new_model(file.path(nonmem, mod_number)) | ||
} | ||
View(as.data.frame(available.packages())) | ||
mod_number <- "1001" | ||
if (file.exists(file.path(nonmem, paste0(mod_number, ".yaml")))) { | ||
mod <- bbr::read_model(file.path(nonmem, mod_number)) | ||
} else { | ||
mod <- bbr::new_model(file.path(nonmem, mod_number)) | ||
} | ||
submission <- slurmtools::submit_nonmem_model( | ||
mod, | ||
slurm_job_template_path = file.path(nonmem, "slurm-job-bbi.tmpl"), | ||
slurm_template_opts = list( | ||
bbi_exe_path = Sys.which("bbi"), | ||
bbi_config_path = file.path(nonmem, "bbi.yaml")) | ||
) | ||
submission | ||
submitted_job_id <- submission$stdout | ||
submitted_job_id <- strsplit(submitted_job_id, "\n")[[1]] | ||
submitted_job_id <- tail(strsplit(submitted_job_id, " ")[[1]], 1) | ||
slurmtools::get_slurm_jobs() %>% | ||
dplyr::filter(job_id == submitted_job_id) | ||
parse_job_to_row <- function(job) { | ||
tibble::tibble( | ||
job_id = job$job_id, | ||
job_state = job$job_state, | ||
cpus = job$cpus$number, | ||
partition = job$partition, | ||
standard_input = job$standard_input, | ||
standard_output = job$standard_output, | ||
submit_time = job$submit_time, | ||
start_time = job$start_time, | ||
user_name = job$user_name, | ||
current_working_directory = job$current_working_directory | ||
) | ||
} | ||
parse_jobs_json <- function(.json) { | ||
if (!length(.json$jobs)) { | ||
return(NULL) | ||
} | ||
purrr::list_rbind(purrr::map(.json$jobs, parse_job_to_row)) | ||
} | ||
cmd <- list(cmd = "squeue", args = "--json") | ||
res <- processx::run(cmd$cmd, args = cmd$args) | ||
if (res$status != 0) { | ||
# todo: better handle returning why | ||
rlang::abort("unable to get slurm jobs, test what the output would be by running `squeue --json`") | ||
} | ||
res_df <- parse_jobs_json(jsonlite::fromJSON(res$stdout, simplifyVector = FALSE)) | ||
View(res_df) | ||
View(res_df) | ||
get_slurm_jobs | ||
installed.packages() | ||
View(as.data.frame(installed.packages())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#' Generates a tidyverse-esque onAttach message | ||
#' | ||
#' @return a message to display on attach | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.