Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-31571][R] Overhaul stop/message/warning calls to be more canonical#28365
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
Closed
Uh oh!
There was an error while loading. Please reload this page.
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4da5ded
overhaul stop/message/warning calls to be more translation-friendly/c…
b84c6f3
some missing whitespace
1940eb8
linting
e4b8ca9
fix broken test
b0cf844
Merge branch 'master' into r-stop-paste
06fac7d
Merge branch 'master' into r-stop-paste
dac07eb
Merge branch 'master' into r-stop-paste
54556c3
Merge branch 'master' into r-stop-paste
06ae5a7
Merge branch 'master' into r-stop-paste
5f36b1a
revert usage of gettextf
4d86dc6
missing .
2c92360
missing some call.=FALSE
f278f95
sQuote(., FALSE) is a relatively new addition to R
961ec34
Merge branch 'master' into r-stop-paste
3b3c1af
pick a more logical ordering for valid joinTypes
0c47c19
Merge branch 'master' into r-stop-paste
671288c
Merge branch 'master' into r-stop-paste
02d1728
camelCase
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -89,8 +89,8 @@ install.spark <- function(hadoopVersion = "2.7", mirrorUrl = NULL, | ||
| } | ||
| if (overwrite) { | ||
| message(paste0("Overwrite = TRUE: download and overwrite the tar file", | ||
| "and Spark package directory if they exist.")) | ||
| message("Overwrite = TRUE: download and overwrite the tar file", | ||
| "and Spark package directory if they exist.") | ||
| } | ||
| releaseUrl <- Sys.getenv("SPARKR_RELEASE_DOWNLOAD_URL") | ||
| @@ -103,12 +103,11 @@ install.spark <- function(hadoopVersion = "2.7", mirrorUrl = NULL, | ||
| # can use dir.exists(packageLocalDir) under R 3.2.0 or later | ||
| if (!is.na(file.info(packageLocalDir)$isdir) && !overwrite) { | ||
| if (releaseUrl != "") { | ||
| message(paste(packageName, "found, setting SPARK_HOME to", packageLocalDir)) | ||
| message(packageName, "found, setting SPARK_HOME to", packageLocalDir) | ||
| } else { | ||
| fmt <- "%s for Hadoop %s found, setting SPARK_HOME to %s" | ||
| msg <- sprintf(fmt, version, ifelse(hadoopVersion == "without", "Free build", hadoopVersion), | ||
| packageLocalDir) | ||
| message(msg) | ||
| message(version, " for Hadoop ", | ||
| if (hadoopVersion == "without") "Free build" else hadoopVersion, | ||
| " found, setting SPARK_HOME to ", packageLocalDir) | ||
| } | ||
| Sys.setenv(SPARK_HOME = packageLocalDir) | ||
| return(invisible(packageLocalDir)) | ||
| @@ -127,26 +126,23 @@ install.spark <- function(hadoopVersion = "2.7", mirrorUrl = NULL, | ||
| success <- downloadUrl(releaseUrl, packageLocalPath) | ||
| if (!success) { | ||
| unlink(packageLocalPath) | ||
| stop(paste0("Fetch failed from ", releaseUrl)) | ||
| stop("Fetch failed from ", releaseUrl) | ||
| } | ||
| } else { | ||
| robustDownloadTar(mirrorUrl, version, hadoopVersion, packageName, packageLocalPath) | ||
| } | ||
| } | ||
| message(sprintf("Installing to %s", localDir)) | ||
| message("Installing to ", localDir) | ||
| # There are two ways untar can fail - untar could stop() on errors like incomplete block on file | ||
| # or, tar command can return failure code | ||
| success <- tryCatch(untar(tarfile = packageLocalPath, exdir = localDir) == 0, | ||
| error = function(e) { | ||
| message(e) | ||
| message() | ||
| message(e, "\n") | ||
| FALSE | ||
| }, | ||
| warning = function(w) { | ||
| # Treat warning as error, add an empty line with message() | ||
| message(w) | ||
| message() | ||
| message(w, "\n") | ||
| FALSE | ||
| }) | ||
| if (!tarExists || overwrite || !success) { | ||
| @@ -160,7 +156,7 @@ install.spark <- function(hadoopVersion = "2.7", mirrorUrl = NULL, | ||
| if (!success) stop("Extract archive failed.") | ||
| message("DONE.") | ||
| Sys.setenv(SPARK_HOME = packageLocalDir) | ||
| message(paste("SPARK_HOME set to", packageLocalDir)) | ||
| message("SPARK_HOME set to", packageLocalDir) | ||
| invisible(packageLocalDir) | ||
| } | ||
| @@ -173,7 +169,7 @@ robustDownloadTar <- function(mirrorUrl, version, hadoopVersion, packageName, pa | ||
| if (success) { | ||
| return() | ||
| } else { | ||
| message(paste0("Unable to download from mirrorUrl: ", mirrorUrl)) | ||
| message("Unable to download from mirrorUrl: ", mirrorUrl) | ||
| } | ||
| } else { | ||
| message("MirrorUrl not provided.") | ||
| @@ -201,11 +197,9 @@ robustDownloadTar <- function(mirrorUrl, version, hadoopVersion, packageName, pa | ||
| # remove any partially downloaded file | ||
| unlink(packageLocalPath) | ||
| message("Unable to download from default mirror site: ", mirrorUrl) | ||
| msg <- sprintf(paste("Unable to download Spark %s for Hadoop %s.", | ||
MichaelChirico marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| "Please check network connection, Hadoop version,", | ||
| "or provide other mirror sites."), | ||
| version, ifelse(hadoopVersion == "without", "Free build", hadoopVersion)) | ||
| stop(msg) | ||
| stop("Unable to download Spark ", version, | ||
| " for Hadoop ", if (hadoopVersion == "without") "Free build" else hadoopVersion, | ||
| ". Please check network connection, Hadoop version, or provide other mirror sites.") | ||
| } | ||
| } | ||
| @@ -222,7 +216,7 @@ getPreferredMirror <- function(version, packageName) { | ||
| endPos <- matchInfo + attr(matchInfo, "match.length") - 2 | ||
| mirrorPreferred <- base::substr(linePreferred, startPos, endPos) | ||
| mirrorPreferred <- paste0(mirrorPreferred, "spark") | ||
| message(sprintf("Preferred mirror site found: %s", mirrorPreferred)) | ||
| message("Preferred mirror site found: ", mirrorPreferred) | ||
| } else { | ||
| mirrorPreferred <- NULL | ||
| } | ||
| @@ -231,24 +225,20 @@ getPreferredMirror <- function(version, packageName) { | ||
| directDownloadTar <- function(mirrorUrl, version, hadoopVersion, packageName, packageLocalPath) { | ||
| packageRemotePath <- paste0(file.path(mirrorUrl, version, packageName), ".tgz") | ||
| fmt <- "Downloading %s for Hadoop %s from:\n- %s" | ||
| msg <- sprintf(fmt, version, ifelse(hadoopVersion == "without", "Free build", hadoopVersion), | ||
| packageRemotePath) | ||
| message(msg) | ||
| message("Downloading ", version, " for Hadoop ", | ||
| if (hadoopVersion == "without") "Free build" else hadoopVersion, | ||
| " from:\n- ", packageRemotePath) | ||
| downloadUrl(packageRemotePath, packageLocalPath) | ||
| } | ||
| downloadUrl <- function(remotePath, localPath) { | ||
| isFail <- tryCatch(download.file(remotePath, localPath), | ||
| error = function(e) { | ||
| message(e) | ||
| message() | ||
| message(e, "\n") | ||
| TRUE | ||
| }, | ||
| warning = function(w) { | ||
| # Treat warning as error, add an empty line with message() | ||
| message(w) | ||
| message() | ||
| message(w, "\n") | ||
| TRUE | ||
| }) | ||
| !isFail | ||
| @@ -279,9 +269,9 @@ sparkCachePath <- function() { | ||
| winAppPath <- Sys.getenv("USERPROFILE", unset = NA) | ||
| } | ||
| if (is.na(winAppPath)) { | ||
| stop(paste("%LOCALAPPDATA% and %USERPROFILE% not found.", | ||
| "Please define the environment variable", | ||
| "or restart and enter an installation path in localDir.")) | ||
| stop("%LOCALAPPDATA% and %USERPROFILE% not found.", | ||
| "Please define the environment variable", | ||
| "or restart and enter an installation path in localDir.") | ||
| } else { | ||
| path <- file.path(winAppPath, "Apache", "Spark", "Cache") | ||
| } | ||
| @@ -293,7 +283,7 @@ sparkCachePath <- function() { | ||
| Sys.getenv("XDG_CACHE_HOME", file.path(Sys.getenv("HOME"), ".cache")), "spark") | ||
| } | ||
| } else { | ||
| stop(sprintf("Unknown OS: %s", .Platform$OS.type)) | ||
| stop("Unknown OS: ", .Platform$OS.type) | ||
| } | ||
| normalizePath(path, mustWork = FALSE) | ||
| } | ||
| @@ -322,7 +312,7 @@ installInstruction <- function(mode) { | ||
| "If you need further help, ", | ||
| "contact the administrators of the cluster.") | ||
| } else { | ||
| stop(paste0("No instruction found for ", mode, " mode.")) | ||
| stop("No instruction found for mode ", mode) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
here,
pastewas creating an extra space, now fixed