-
Notifications
You must be signed in to change notification settings - Fork 5
Logging improvements #9
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
Conversation
|
With the last few commit I improved the logging system when some functions being analyzed contains as argument data types that are not allowed. In detail, the function
This has been improved, printing for each function not analyzed, the list of parameters that fall out of the allowed list. |
|
Since importing RInside in the R code is not essential, I deleted it from the imports in the most recent commits. There is no need to import RInside because it is already there in the Additionaly I discovered that certain code parts require a little bit of review. For instance, there are parts of the code that are not used, such variable definitions. For example, I deleted the following line in the commit b012edb. prototypes_calls <-deepstate_get_prototype_calls(package_path)Because RcppDeepState is all about speed and performance to run the tests, even little adjustments like this one may have some impact. |
|
With the most recent updates, I added the |
|
@tdhock do you think I need to make any other adjustments? I plan to review again the logging part later on. |
.github/workflows/run_test.yaml
Outdated
| branches: [test-debug-symbols, logging-improvements] | ||
| pull_request: | ||
| branches: [test-debug-symbols] | ||
| branches: [test-debug-symbols, logging-improvements] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there some way to specify all branches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I modified the workflow such that the "R CMD check" command is run on each branch.
Fixed in commit 6b85147
R/analyze_binary.R
Outdated
| } | ||
| for(pkg.i in seq_along(test.files)){ | ||
| list_testfiles[basename(test.files[[pkg.i]])] <- list(deepstate_analyze_fun(path,basename(test.files[[pkg.i]]),max_inputs)) | ||
| list_testfiles[basename(test.files[[pkg.i]])] <- list(deepstate_analyze_fun(path,basename(test.files[[pkg.i]]), max_inputs, verbose)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use double square brackets on left side of <- and remove list() from right side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I solved this in the commit 1d7e9cc
R/get-pkgs.R
Outdated
|
|
||
|
|
||
|
|
||
| return(list(1,c())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit return is not needed at end of function, please remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely reviewed the entire function and changed it's name to deepstate_get_mismatched_datatypes. Now his function returns the list of mismatched arguments, instead of returning 0 or 1 alongside with the mismatched datatypes.
R/get-pkgs.R
Outdated
| datatypes <- list("NumericVector","NumericMatrix" ,"arma::mat","double", | ||
| "string","CharacterVector","int","IntegerVector") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the list of supported data types right? So rather than "mismatched" in the function name maybe "unsupported" would be more appropriate?
Also this list is redundant with the logic in https://github.com/FabrizioSandri/RcppDeepState/blob/master/R/fun_harness_create.R -- if you have time it would be good to reorganize that code so that a list or table is used to lookup what to do, rather than the current code which is rather difficult to understand (lots of if/else statements).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, this list is redundant. I updated the deepstate_fun_create function inside fun_harness_create.R and replaced the if else statements with a table containing information for the supported datatypes. In detail each column of this table corresponds to a supported datatype and provides some details on it. The first row of this table contains an alternative datatype to be used when saving the inputs(e.g., using qs::c_qsave), whereas the second row correspond to the associated generation function that takes as input a range. When a datatype contains a value of NA in both rows, it means that is supported, utilizes itself when executing qs::c_qsave and lacks a range function. In this way checking if a datatype is supported is really simple: just check if exists a column for the datatype in this table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the function deepstate_get_unsupported_datatypes may now be removed.
|
for the list of supported types, instead of one column per type please try one row per type like this: datatype <- function(ctype,rtype,args)data.table(ctype,rtype,args)
types_table <- rbind(
datatype("int", "IntegerVector", "(low,high)"),
datatype("double", "NumericVector", "(low,high)"))
setkey(types_table, ctype)
type_info <- types_table[my_type]
type_info$args |
|
@tdhock I replaced the list of supported datatypes with the |
R/analyze_binary.R
Outdated
| } | ||
| for(pkg.i in seq_along(test.files)){ | ||
| list_testfiles[[basename(test.files[[pkg.i]])]] <- deepstate_analyze_fun(path,basename(test.files[[pkg.i]]), max_inputs, verbose) | ||
| list_testfiles[[basename(test.files[[pkg.i]])]] <- deepstate_analyze_fun(path,basename(test.files[[pkg.i]]), max_inputs, verbose=verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you use basename(test.files[[pkg.i]]) twice please create an intermediate variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Updated in the commit 7b4d7e9
Description
The purpose of this pull request is to improve the logging system of RcppDeepState.
In this way developers that will be able to rapidly identify any issues that may arise using this library.