-
Notifications
You must be signed in to change notification settings - Fork 0
/
_targets.R
43 lines (39 loc) · 1.12 KB
/
_targets.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
library(targets)
library(future)
library(future.batchtools)
# basic check for existence of SLURM job submission command to determine if
# running on a SLURM-enabled server
if(system('command -v sbatch') == 0) {
nnodes = as.numeric(Sys.getenv('SLURM_JOB_NUM_NODES'))
if(is.na(nnodes)) {
nnodes = 1
}
if(nnodes > 1) {
plan(cluster, workers = snow::getMPIcluster())
} else {
plan(batchtools_slurm, template = file.path("hpc", "slurm_batchtools.tmpl"))
}
} else {
plan(multisession)
}
# set packages to load
tar_option_set(
packages = c('dplyr', 'lubridate', 'ggplot2', 'ggthemes', 'stringr',
'nimble', 'expm', 'pryr', 'suncalc', 'tarchetypes', 'coda',
'tidyr', 'future', 'future.batchtools', 'viridis', 'splines2',
'scoringRules', 'ggpubr', 'xtable'),
deployment = 'main'
)
## load R files and workflows
lapply(list.files("R", full.names = TRUE, recursive = TRUE, pattern = '\\.R'),
source)
# assemble workflow
c(
data_targets,
depth_bin_imputation_targets,
dive_segmentation_targets,
nimble_targets,
validation_nstep_targets,
plot_targets,
cee_targets
)