Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added project_name and path to default template list. Updated vignette. #8

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions R/submit-model.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,13 @@ submit_nonmem_model <-
bbi_exe_path <- slurm_template_opts$bbi_exe_path
}


if (is.null(slurm_template_opts$project_path)) {
project_path <- rstudioapi::getActiveProject()
project_path <- here::here()
} else {
project_path <- slurm_template_opts$project_path
}
if (is.null(slurm_template_opts$project_name)) {
project_name <- tools::file_path_sans_ext(
list.files(
path = project_path,
pattern = ".Rproj$")
)
project_name <- here::here() %>% basename()
} else {
project_name <- slurm_template_opts$project_name
}
Expand Down
9 changes: 7 additions & 2 deletions vignettes/Running-nonmem.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ This function uses the inputs to populate a template Bash shell script that subm
By default these values are provided to the slurm template file:

``` r
list(
default_template_list = list(
partition = partition,
parallel = parallel,
ncpu = ncpu,
job_name = sprintf("%s-nonmem-run", basename(.mod$absolute_model_path)),
project_path = project_path,
project_name = project_name,
bbi_exe_path = Sys.which("bbi"),
bbi_config_path = bbi_config_path,
model_path = .mod$absolute_model_path,
Expand Down Expand Up @@ -99,6 +101,7 @@ Here is an example of a template file that will call `bbi`:
#SBATCH --ntasks=1
#SBATCH --cpus-per-task={{ncpu}}
#SBATCH --partition={{partition}}
#SBATCH --account={{project_name}}

# submit_nonmem_model uses the whisker package to populate template files
# https://github.com/edwindj/whisker
Expand Down Expand Up @@ -154,7 +157,7 @@ submission <- slurmtools::submit_nonmem_model(
submission
```

Notice we get a Warning about a config.toml file not being found. I'll expand on that later, but for now we see a `status` with an exit code of 0 suggesting a successful command, and the `stdout` gives us the batch job number. We can use `slurmtools::get_slurm_jobs()` to monitor the status of the job. Here, we can supply the user = "matthews" argument to filter to just the jobs I've submitted.
We see a `status` with an exit code of 0 suggesting a successful command, and the `stdout` gives us the batch job number. We can use `slurmtools::get_slurm_jobs()` to monitor the status of the job. Here, we can supply the user = "matthews" argument to filter to just the jobs I've submitted.

```{r}
slurmtools::get_slurm_jobs(user = 'matthews')
Expand All @@ -181,6 +184,7 @@ Here is a modified template file that adds a `JOBID=$SLURM_JOBID` and some ntfy
#SBATCH --ntasks=1
#SBATCH --cpus-per-task={{ncpu}}
#SBATCH --partition={{partition}}
#SBATCH --account={{project_name}}

JOBID=$SLURM_JOBID

Expand Down Expand Up @@ -231,6 +235,7 @@ Note that the run number will match the run specified in `submission$stdout`. We
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --partition=cpu2mem4gb
#SBATCH --account=slurmtools

JOBID=$SLURM_JOBID

Expand Down
3 changes: 1 addition & 2 deletions vignettes/custom-alerts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ not give you the path to the nmm binary if it is on your path or not. We
can inject the `nmm_exe_path` like we did with `bbi_exe_path` and assume
it's not on our path.

Remember that error about the `config.toml` file not existing? Well this
is the reason. This file controls what `nmm` will monitor and where to
The `config.toml` file controls what `nmm` will monitor and where to
look for files and how to alert you. We'll use `generate_nmm_config()`
to create this file. First we can look at the documentation to see what
type of information we should pass to this function.![documentation for
Expand Down
1 change: 1 addition & 0 deletions vignettes/model/nonmem/slurm-job-bbi-ntfy.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#SBATCH --ntasks=1
#SBATCH --cpus-per-task={{ncpu}}
#SBATCH --partition={{partition}}
#SBATCH --account={{project_name}}

JOBID=$SLURM_JOBID

Expand Down
3 changes: 2 additions & 1 deletion vignettes/model/nonmem/slurm-job-bbi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#SBATCH --ntasks=1
#SBATCH --cpus-per-task={{ncpu}}
#SBATCH --partition={{partition}}

#SBATCH --account={{project_name}}
#{{project_path}}
unset SLURM_NODELIST
unset SLURM_JOB_NODELIST
unset SLURM_JOB_USER
Expand Down
Loading