VEuPathDB/service-eda

add validation to avoid 500 from rserve (check the 500s in rserve repo issues)

Closed this issue · 2 comments

read: https://epvb.slack.com/archives/C03PTKWGUPM/p1725496228770889

in fir
[aurreco@fir ~]$ vi /var/log/containers/docker.eda_prod_rserve_1.log

2024-09-04 19:16:40.208918 Base data types updated for all columns as necessary.

2024-09-04 19:16:40.216076 Base plot.data object created.
Error in validateValues(denominatorValues, .pd[[y]]) :
No supplied values of interest exist as real values in the specified variable.
In addition: Warning messages:
1: replacing previous import ‘veupathUtils::toJSON’ by ‘jsonlite::toJSON’ when loading ‘plot.data’
2: In validateValues(denominatorValues, .pd[[y]]) :
At least one value of interest does not exist as a real value in the specified variable.

Based on a slack thread, my original thought that we could address this generally with a utility sounds unworkable. The original idea was:

This bug sounds like a certain variable has all nulls in the subset selected and R cannot handle that elegantly, so maybe we could have viz plugins tell the Java infra code which columns must have at least one non-null value and write some Java to scan the lines as they pass into R making sure the specified cols have at least one value, then throwing a 4xx if not.

But Danielle clarified that that was NOT the error in this case. The variable in question had values, just not the right values to match some criteria. She also said there are a variety of similar problems like this that could arise that are very case-by-case and viz plugin specific (based on how the data is used in R). She also clarified that since RServe doesn't use HTTP, the R code can't categorize errors into 400s vs 500s.

So, I think the best we can do at this point is, as a default case, if R throws an error, try to package up the error message to look as nice as we can and throw it as a 400. Hopefully user can resolve. And when we see errors we know are NOT because of the data (e.g. bugs or cannot connect to RServe), we can look for those specifically and throw 500s for them (or fix the bugs).

sounds good!!