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

fix-notes/warnings/errors in base packages #3196

Merged
merged 26 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bc041d7
fixed remaining notes/warnings/errors in corresponding base packages
moki1202 Jul 11, 2023
3790470
added few documentations
moki1202 Jul 12, 2023
32c6e7e
Update base/settings/R/MultiSettings.R
moki1202 Jul 13, 2023
19b5ca8
Update base/settings/R/check.all.settings.R
moki1202 Jul 13, 2023
ab92118
Update base/settings/R/MultiSettings.R
moki1202 Jul 13, 2023
c917555
Update base/settings/R/MultiSettings.R
moki1202 Jul 13, 2023
b5fb4e9
Update base/settings/R/addSecrets.R
moki1202 Jul 13, 2023
b819735
Update base/settings/R/fix.deprecated.settings.R
moki1202 Jul 13, 2023
316be28
Update base/settings/R/listToXml.R
moki1202 Jul 13, 2023
d1b7f72
Update base/settings/R/listToXml.R
moki1202 Jul 13, 2023
475b268
Update base/settings/R/listToXml.R
moki1202 Jul 13, 2023
215258b
Update base/settings/R/update.settings.R
moki1202 Jul 13, 2023
524cc42
Update base/utils/R/write.config.utils.R
moki1202 Jul 13, 2023
216eb88
Update base/utils/R/write.config.utils.R
moki1202 Jul 13, 2023
5917ec7
fixed comments
moki1202 Jul 13, 2023
2007ff4
added roxygen updates
moki1202 Jul 20, 2023
ec2c18f
Merge branch 'develop' into base_remaining_notes
infotroph Jul 21, 2023
983a332
Merge branch 'develop' into base_remaining_notes
infotroph Sep 27, 2023
064793e
Merge branch 'develop' into base_remaining_notes
infotroph Nov 4, 2023
8431210
Merge branch 'develop' into base_remaining_notes
infotroph Nov 18, 2023
3c18a24
Merge branch 'develop' into base_remaining_notes
infotroph Nov 24, 2023
013ac05
Merge branch 'develop' into base_remaining_notes
infotroph Dec 17, 2023
b869ceb
roxygen
infotroph Dec 17, 2023
491de4a
Merge branch 'develop' into base_remaining_notes
infotroph Dec 23, 2023
be43937
document ...
infotroph Dec 30, 2023
baa6b6d
Update base/workflow/R/run.write.configs.R
moki1202 Jan 3, 2024
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
3 changes: 2 additions & 1 deletion base/remote/R/remote.execute.R.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#'
#' @title Execute command remotely
#' @param script the script to be invoked, as a list of commands.
#' @param args a character vector of arguments to command.
#' @param host settings host list
#' @param user the username to use for remote login
#' @param verbose should the output be printed to the console
#' @param R Path to the R executable or binary file.
#' @param scratchdir Path to the scratch directory for temporary files during remote execution.
#' @return the captured output of the command (both stdout and stderr)
#' @author Rob Kooper
#' @export
Expand Down
2 changes: 1 addition & 1 deletion base/remote/R/remote.execute.cmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' machine it will execute the command locally without ssh.
#'
#' @title Execute command remotely
#' @param command the system command to be invoked, as a character string.
#' @param cmd the system command to be invoked, as a character string.
#' @param host host structure to execute command on
#' @param args a character vector of arguments to command.
#' @param stderr should stderr be returned as well.
Expand Down
2 changes: 2 additions & 0 deletions base/remote/R/test_remote.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#' Test remote execution
#'
#' @inheritParams remote.execute.cmd
#'
#' @param ... additional arguments.
#'
#' @return `TRUE` is remote execution is successful.
#' If unsuccessful, depends on the value of `stderr`.
Expand Down
3 changes: 3 additions & 0 deletions base/remote/man/merge_job_files.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion base/remote/man/remote.execute.R.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions base/remote/man/remote.execute.cmd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/remote/man/test_remote.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion base/settings/R/MultiSettings.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ names.MultiSettings <- function(x) {
stop("Can't name MultiSettings this way. Use settingNames() instead.")
}

#' function that can retrieve or update the names of multi-settings.
#'
#' @param multiSettings object for which to retrieve or set the names.
#' @param settingNames names to be set for the multi-settings object.
#'
#' @export
settingNames <- function(multiSettings, settingNames) {
if (missing(settingNames)) {
Expand All @@ -159,6 +164,10 @@ print.MultiSettings <- function(x, printAll = FALSE, ...) {
}
}

#' generic function for printing contents of objects.
#'
#' @param x object to be printed.
#'
#' @export
printAll <- function(x) {
UseMethod("printAll", x)
Expand Down Expand Up @@ -196,7 +205,10 @@ listToXml.MultiSettings <- function(item, tag, collapse = TRUE) {
NextMethod()
} # listToXml.MultiSettings


#' generic function for expanding multi-settings.
#'
#' @param x object to be expanded.
#'
#' @export
expandMultiSettings <- function(x) {
UseMethod("expandMultiSettings")
Expand Down
1 change: 1 addition & 0 deletions base/settings/R/addSecrets.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#'
#' @title Add Users secrets
#' @param settings settings file
#' @param force Logical: add secrets even if they have been added previously?
#' @return will return the updated settings values
#' @author Rob Kooper
#' @export addSecrets
Expand Down
12 changes: 12 additions & 0 deletions base/settings/R/check.all.settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ check.bety.version <- function(dbcon) {
#' - pfts with at least one pft defined
#' @title Check Settings
#' @param settings settings file
#' @param force Logical: Rerun check even if these settings have been checked previously?
#' @return will return the updated settings values with defaults set.
#' @author Rob Kooper, David LeBauer
#' @export check.settings
Expand Down Expand Up @@ -614,6 +615,7 @@ check.settings <- function(settings, force = FALSE) {

#' @title Check Run Settings
#' @param settings settings file
#' @param dbcon database connection.
#' @export check.run.settings
check.run.settings <- function(settings, dbcon = NULL) {
scipen <- getOption("scipen")
Expand Down Expand Up @@ -805,6 +807,7 @@ check.run.settings <- function(settings, dbcon = NULL) {

#' @title Check Model Settings
#' @param settings settings file
#' @param dbcon database connection.
#' @export check.model.settings
check.model.settings <- function(settings, dbcon = NULL) {
# check modelid with values
Expand Down Expand Up @@ -1077,6 +1080,7 @@ check.database.settings <- function(settings) {
#' @param settings settings file
#' @export check.ensemble.settings
check.ensemble.settings <- function(settings) {

infotroph marked this conversation as resolved.
Show resolved Hide resolved
# check ensemble
if (!is.null(settings$ensemble)) {
if (is.null(settings$ensemble$variable)) {
Expand All @@ -1097,6 +1101,10 @@ check.ensemble.settings <- function(settings) {

if (is.null(settings$ensemble$start.year)) {
if (!is.null(settings$run$start.date)) {
startdate <- lubridate::parse_date_time(
settings$run$start.date,
"ymd_HMS",
truncated = 3)
settings$ensemble$start.year <- lubridate::year(
settings$run$start.date)
PEcAn.logger::logger.info(
Expand All @@ -1116,6 +1124,10 @@ check.ensemble.settings <- function(settings) {

if (is.null(settings$ensemble$end.year)) {
if (!is.null(settings$run$end.date)) {
enddate <- lubridate::parse_date_time(
settings$run$end.date,
"ymd_HMS",
truncated = 3)
settings$ensemble$end.year <- lubridate::year(settings$run$end.date)
PEcAn.logger::logger.info(
"No end date passed to ensemble - using the run date (",
Expand Down
1 change: 1 addition & 0 deletions base/settings/R/clean.settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#' @param inputfile the PEcAn settings file to be used.
#' @param outputfile the name of file to which the settings will be
#' written inside the outputdir.
#' @param write Indicates whether to write the modified settings to a file.
#' @return list of all settings as saved to the XML file(s)
#' @export clean.settings
#' @author Rob Kooper
Expand Down
1 change: 1 addition & 0 deletions base/settings/R/fix.deprecated.settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#'
#' @title Fix Deprecated Settings
#' @param settings settings list
#' @param force Logical: re-run fixing of deprecated settings even if it has been done previously?
#' @return updated settings list
#' @author Ryan Kelly
#' @export fix.deprecated.settings
Expand Down
44 changes: 27 additions & 17 deletions base/settings/R/listToXml.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#' A generic function to convert list to XML
#'
moki1202 marked this conversation as resolved.
Show resolved Hide resolved
#' @param x list to be converted
#' @param ... arguments passed to methods
#' @export
listToXml <- function(x, ...) {
UseMethod("listToXml")
Expand All @@ -8,43 +12,49 @@ listToXml <- function(x, ...) {
#'
#' Can convert list or other object to an xml object using xmlNode
#' @title List to XML
#' @param item object to be converted.
#' @param x object to be converted.
#' Despite the function name, need not actually be a list
#' @param tag xml tag
#' @return xmlNode
#' @export
#' @author David LeBauer, Carl Davidson, Rob Kooper
listToXml.default <- function(item, tag) {

listToXml.default <- function(x, ...) {
args <- list(...)
if (length(args) == 0) {
PEcAn.logger::logger.error("no tag provided")
} else if ("tag" %in% names(args)) {
tag <- args$tag
} else {
tag <- args[[1]]
}
# just a textnode, or empty node with attributes
if (typeof(item) != "list") {
if (length(item) > 1) {
if (typeof(x) != "list") {
if (length(x) > 1) {
xml <- XML::xmlNode(tag)
for (name in names(item)) {
XML::xmlAttrs(xml)[[name]] <- item[[name]]
for (name in names(x)) {
XML::xmlAttrs(xml)[[name]] <- x[[name]]
}
return(xml)
} else {
return(XML::xmlNode(tag, item))
return(XML::xmlNode(tag, x))
}
}

# create the node
if (identical(names(item), c("text", ".attrs"))) {
if (identical(names(x), c("text", ".attrs"))) {
# special case a node with text and attributes
xml <- XML::xmlNode(tag, item[["text"]])
xml <- XML::xmlNode(tag, x[["text"]])
} else {
# node with child nodes
xml <- XML::xmlNode(tag)
for (i in seq_along(item)) {
if (is.null(names(item)) || names(item)[i] != ".attrs") {
xml <- XML::append.xmlNode(xml, listToXml(item[[i]], names(item)[i]))
for (i in seq_along(x)) {
if (is.null(names(x)) || names(x)[i] != ".attrs") {
xml <- XML::append.xmlNode(xml, listToXml(x[[i]], names(x)[i]))
}
}
}

# add attributes to node
attrs <- item[[".attrs"]]
attrs <- x[[".attrs"]]
for (name in names(attrs)) {
XML::xmlAttrs(xml)[[name]] <- attrs[[name]]
}
Expand Down
1 change: 1 addition & 0 deletions base/settings/R/update.settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @title Update Settings
#' @name update.settings
#' @param settings settings file
#' @param force Logical: update even if settings have previously been updated?.
#' @return will return the updated settings values
#' @export update.settings
#' @author Rob Kooper
Expand Down
6 changes: 3 additions & 3 deletions base/settings/man/MultiSettings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions base/settings/man/SafeList.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions base/settings/man/Settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/settings/man/addSecrets.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/settings/man/check.model.settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/settings/man/check.run.settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/settings/man/check.settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/settings/man/clean.settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions base/settings/man/expandMultiSettings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions base/settings/man/fix.deprecated.settings.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading