-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19387][SPARKR] Tests do not run with SparkR source package in CRAN check #16720
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
|
Hmm - another fix could be that in the test cases whenever we create |
|
yes, that is described in the PR description: And beside, it is conceivable that these tests could be set to run in a cluster, in which case we could expect SPARK_HOME is set but master is not local. (with this PR that would still work properly) |
|
I think better would be the approach being taken in PR 16330 - has a first run test that prepare and run these kind of global thing https://github.com/apache/spark/pull/16330/files#diff-5ff1ba5d1751f3b1cc96a567e9ab25ff |
|
Test build #72082 has finished for PR 16720 at commit
|
|
I am not sure tests are ever meant to run on a cluster (see the number of uses of LocalSparkContext in core/src/test/scala) -- The main reason I dont want to introduce the 'first test' approach is that we are then relying too much on test names not clashing / getting in front of each other which seems fragile. The other thing that might be good is to create a test util function like |
|
Sure, I've simplified it. Good point on the ordering - digging into it looks like it's just file system search order, which really is not reliable. We could certainly add a test util - though seems like some tests are different though, for example test_context.R doesn't need a SparkSession. |
|
Test build #72103 has finished for PR 16720 at commit
|
R/pkg/vignettes/sparkr-vignettes.Rmd
Outdated
| We use default settings in which it runs in local mode. It auto downloads Spark package in the background if no previous installation is found. For more details about setup, see [Spark Session](#SetupSparkSession). | ||
|
|
||
| ```{r, include=FALSE} | ||
| SparkR:::sparkCheckInstall() |
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 it ok to include a ::: function in the vignette ?
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 has include=FALSE so it will run but the code and output will not be included in the vignettes text
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 the Rmd file a part of the install that the users see ? I just dont want to put in any code that people might copy-paste etc. Is it not good enough to pass in master=local[*] here ?
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.
FWIW These vignette changes are still needed even if we update run-all.R
| context("functions in utils.R") | ||
|
|
||
| # Ensure Spark is installed | ||
| sparkCheckInstall() |
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 I had in mind was to combine the sparkR.session and this sparkCheckInstall into one function so its easy to remember for a new test file. Any thoughts on 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.
I understand that, but as pointed out #16720 (comment), some tests don't need SparkSession, and some tests will create/stop one as needed, and to have a function that does that all just mean more complexity?
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.
Sure - that sounds fine. I was looking to see if testthat had any support for writing a setup that gets called before each test - Doesn't look like it has that
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.
hmm, we could put it in https://github.com/apache/spark/blob/master/R/pkg/tests/run-all.R?
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.
Ah thats a great idea - Can you see if that works (unfortunately it needs manual verification) ?
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.
Any luck testing this out ?
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.
sorry, I"m really swamped, haven't had the chance to test that out yet
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 just tested this by putting SparkR:::checkInstall in run-all.R (before calling test_package) and that seems to do the trick on a custom 2.1.0 build !
@felixchueng when you get a chance can you update the PR with that ? The only thing that I'm concerned about is calling a private function from run-all.R - We could either export this function or move some of this functionality into install.spark
|
Great! Sure will do.
I agree, I think we should consider integrating this into install.spark although that would be a change in behavior (for the better?)
|
|
found another issue, opened SPARK-19568 |
|
Test build #72793 has finished for PR 16720 at commit
|
|
LGTM. I patched this again on top of 2.1.0 and |
…CRAN check ## What changes were proposed in this pull request? - this is cause by changes in SPARK-18444, SPARK-18643 that we no longer install Spark when `master = ""` (default), but also related to SPARK-18449 since the real `master` value is not known at the time the R code in `sparkR.session` is run. (`master` cannot default to "local" since it could be overridden by spark-submit commandline or spark config) - as a result, while running SparkR as a package in IDE is working fine, CRAN check is not as it is launching it via non-interactive script - fix is to add check to the beginning of each test and vignettes; the same would also work by changing `sparkR.session()` to `sparkR.session(master = "local")` in tests, but I think being more explicit is better. ## How was this patch tested? Tested this by reverting version to 2.1, since it needs to download the release jar with matching version. But since there are changes in 2.2 (specifically around SparkR ML) that are incompatible with 2.1, some tests are failing in this config. Will need to port this to branch-2.1 and retest with 2.1 release jar. manually as: ``` # modify DESCRIPTION to revert version to 2.1.0 SPARK_HOME=/usr/spark R CMD build pkg # run cran check without SPARK_HOME R CMD check --as-cran SparkR_2.1.0.tar.gz ``` Author: Felix Cheung <[email protected]> Closes #16720 from felixcheung/rcranchecktest. (cherry picked from commit a3626ca) Signed-off-by: Shivaram Venkataraman <[email protected]>
…CRAN check ## What changes were proposed in this pull request? - this is cause by changes in SPARK-18444, SPARK-18643 that we no longer install Spark when `master = ""` (default), but also related to SPARK-18449 since the real `master` value is not known at the time the R code in `sparkR.session` is run. (`master` cannot default to "local" since it could be overridden by spark-submit commandline or spark config) - as a result, while running SparkR as a package in IDE is working fine, CRAN check is not as it is launching it via non-interactive script - fix is to add check to the beginning of each test and vignettes; the same would also work by changing `sparkR.session()` to `sparkR.session(master = "local")` in tests, but I think being more explicit is better. ## How was this patch tested? Tested this by reverting version to 2.1, since it needs to download the release jar with matching version. But since there are changes in 2.2 (specifically around SparkR ML) that are incompatible with 2.1, some tests are failing in this config. Will need to port this to branch-2.1 and retest with 2.1 release jar. manually as: ``` # modify DESCRIPTION to revert version to 2.1.0 SPARK_HOME=/usr/spark R CMD build pkg # run cran check without SPARK_HOME R CMD check --as-cran SparkR_2.1.0.tar.gz ``` Author: Felix Cheung <[email protected]> Closes apache#16720 from felixcheung/rcranchecktest.
What changes were proposed in this pull request?
master = ""(default), but also related to SPARK-18449 since the realmastervalue is not known at the time the R code insparkR.sessionis run. (mastercannot default to "local" since it could be overridden by spark-submit commandline or spark config)sparkR.session()tosparkR.session(master = "local")in tests, but I think being more explicit is better.How was this patch tested?
Tested this by reverting version to 2.1, since it needs to download the release jar with matching version. But since there are changes in 2.2 (specifically around SparkR ML) that are incompatible with 2.1, some tests are failing in this config. Will need to port this to branch-2.1 and retest with 2.1 release jar.
manually as: