forked from achubaty/LandR_MPB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04-options.R
64 lines (54 loc) · 2.26 KB
/
04-options.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
## cache database connection (requires reproducbile >= 1.0.0)
cacheDBconn <- if (config::get("cachedb") == "sqlite") {
Require("RSQLite")
NULL
} else if (config::get("cachedb") == "postgresql") {
Require("RPostgres")
DBI::dbConnect(drv = RPostgres::Postgres(),
host = Sys.getenv("PGHOST"),
port = Sys.getenv("PGPORT"),
dbname = Sys.getenv("PGDATABASE"),
user = Sys.getenv("PGUSER"),
password = Sys.getenv("PGPASSWORD"))
} else {
stop("Unsupported cache database type '", config::get("cachedb"), "'")
}
rep <- config::get("rep")
maxMemory <- 6e+10
rasterOptions(default = TRUE)
opts <- options(
"fftempdir" = scratchDir,
"future.globals.maxSize" = 1000*1024^2,
"rasterMaxMemory" = maxMemory,
"rasterTmpDir" = scratchDir,
"reproducible.cachePath" = file.path(scratchDir, "cache"),
"reproducible.cacheSaveFormat" = cacheFormat, ## can be "qs" or "rds"
"reproducible.conn" = cacheDBconn,
"reproducible.destinationPath" = normPath(paths1$inputPath),
"reproducible.futurePlan" = FALSE,
"reproducible.inputPaths" = userInputPaths,
"reproducible.nThreads" = 2,
"reproducible.overwrite" = TRUE,
"reproducible.quick" = FALSE,
"reproducible.showSimilar" = TRUE,
"reproducible.showSimilarDepth" = showSimilarDepth,
"reproducible.useCache" = TRUE,
"reproducible.useCloud" = TRUE,
"reproducible.useGDAL" = FALSE, ## NOTE: GDAL can be faster, but mixing GDAL with raster causes inconsistencies
"reproducible.useMemoise" = useMemoise,
"reproducible.useNewDigestAlgorithm" = 2,
"reproducible.useRequire" = TRUE,
"spades.moduleCodeChecks" = FALSE,
"spades.nThreads" = 4,
"spades.recoveryMode" = recoveryMode,
"spades.restartR.restartDir" = paths3$outputPath,
"spades.useRequire" = FALSE # Don't use Require... meaning assume all pkgs installed
)
setDTthreads(DTthreads)
Require("googledrive")
httr::set_config(httr::config(http_version = 0))
token <- NA_character_
if (is.na(token) || !file.exists(token))
message(crayon::red("No Google service token found; authenticating with user token..."))
drive_auth(email = config::get("googleuser"), use_oob = quickPlot::isRstudioServer())
message(crayon::silver("Authenticating as: "), crayon::green(drive_user()$emailAddress))