EHDEN / CdmInspection

R Package to support quality control inspection of an OMOP-CDM instance
Apache License 2.0
11 stars 16 forks source link

Error: x must be a string of length 1 (multiple CPUs) #73

Closed nadavrap closed 2 years ago

nadavrap commented 2 years ago

I have encountered the same error as closed issue #59 ,

> generateResultsDocument(results,outputFolder, authors=authors, databaseDescription = databaseDescription, databaseName = databaseName, databaseId = databaseId, smallCellCount = smallCellCount)
Error: `x` must be a string of length 1

But for a different reason. The code line that causes the error is in the generateResultsDocument function:

doc <- doc %>% officer::body_add_par(value = "System Information", 
      style = "heading 2") %>% officer::body_add_par(paste0("Installed R version: ", 
      results$sys_details$r_version$version.string)) %>% 
      officer::body_add_par(paste0("System CPU vendor: ", 
        results$sys_details$cpu$vendor_id)) %>% officer::body_add_par(paste0("System CPU model: ", 
      results$sys_details$cpu$model_name)) %>% officer::body_add_par(paste0("System CPU number of cores: ", 
      results$sys_details$cpu$no_of_cores)) %>% officer::body_add_par(paste0("System RAM: ", 
      prettyunits::pretty_bytes(as.numeric(results$sys_details$ram)))) %>% 
      officer::body_add_par(paste0("DBMS: ", results$dms)) %>% 
      officer::body_add_par(paste0("WebAPI version: ", 
        results$webAPIversion)) %>% officer::body_add_par(" ")

Specifically, the part results$sys_details$cpu$model_name on my system (Linux EC2) returns a vector of length 2:

> results$sys_details$cpu$model_name
[1] "Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz"  "Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz"

Maybe a resolution would use a 'paste' function here or take one of those.

MaximMoinat commented 2 years ago

@nadavrap Thanks for reporting. This is indeed an edge-case that was not accounted for.

Would you be able to test the hotfix? You can install this with devtools::install_github('EHDEN/CdmInspection', ref='fix-73'). Thanks!

nadavrap commented 2 years ago

It seems that it doesn't work yet:

devtools::install_github('EHDEN/CdmInspection', ref='fix-73', force=TRUE)
Downloading GitHub repo EHDEN/CdmInspection@fix-73

✓  checking for file ‘/tmp/RtmpVQLSbw/remotes5ddb56424523/EHDEN-CdmInspection-a515bd7/DESCRIPTION’ ...
─  preparing ‘CdmInspection’:
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘CdmInspection_1.0.4.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'

Installing package into ‘/home/nadav.rappoport/R/x86_64-koji-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘CdmInspection’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘CdmInspection’
    finding HTML links ... done
    bundleResults                           html  
    cdmInspection                           html  
    dataTablesChecks                        html  
    generateResultsDocument                 html  
    performanceChecks                       html  
    vocabularyChecks                        html  
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (CdmInspection)
> packageVersion('CdmInspection')
[1] ‘1.0.4’
> CdmInspection::generateResultsDocument(results,outputFolder, authors=authors, databaseDescription = databaseDescription, databaseName = databaseName, databaseId = databaseId, smallCellCount = smallCellCount)
Error: `x` must be a string of length 1
MaximMoinat commented 2 years ago

Thanks for testing. Do you know whether the error is on the same or a different line in the generateResultsDocument function? Then we can take another look.

nadavrap commented 2 years ago

Actually, I think that the installation failed. When I print the function I see this part:

doc <- doc %>% officer::body_add_par(value = "System Information", 
            style = "heading 2") %>% officer::body_add_par(paste0("Installed R version: ", 
            results$sys_details$r_version$version.string)) %>% 
            officer::body_add_par(paste0("System CPU vendor: ", 
                results$sys_details$cpu$vendor_id)) %>% officer::body_add_par(paste0("System CPU model: ", 
            results$sys_details$cpu$model_name)) %>% officer::body_add_par(paste0("System CPU number of cores: ", 
            results$sys_details$cpu$no_of_cores)) %>% officer::body_add_par(paste0("System RAM: ", 
            prettyunits::pretty_bytes(as.numeric(results$sys_details$ram)))) %>% 
            officer::body_add_par(paste0("DBMS: ", results$dms)) %>% 
            officer::body_add_par(paste0("WebAPI version: ", 
                results$webAPIversion)) %>% officer::body_add_par(" ")

Which is still the pre-fixed version. Isn't it?

nadavrap commented 2 years ago

So I tried reinstalling again, and see that it works now. Thank you @MaximMoinat .

MaximMoinat commented 2 years ago

Thanks!