-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
GH-37907: [R] Setting rosetta variable is missing #37961
Conversation
Thanks for making this PR! One small change, otherwise looks good to go :) |
r/R/install-arrow.R
Outdated
@@ -61,6 +61,7 @@ install_arrow <- function(nightly = FALSE, | |||
verbose = Sys.getenv("ARROW_R_DEV", FALSE), | |||
repos = getOption("repos"), | |||
...) { | |||
sysname <- tolower(Sys.info()[["sysname"]]) |
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.
sysname <- tolower(Sys.info()[["sysname"]]) |
r/R/install-arrow.R
Outdated
rosetta <- identical(sysname, "darwin") && identical(system("sysctl -n sysctl.proc_translated", intern = TRUE), "1") | ||
if (rosetta) { |
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.
rosetta <- identical(sysname, "darwin") && identical(system("sysctl -n sysctl.proc_translated", intern = TRUE), "1") | |
if (rosetta) { | |
rosetta <- on_rosetta() | |
if (rosetta) { |
Another PR implemented a function on_rosetta()
that already does these checks, so we can simplify this bit here, and remove the creation of the sysname
variable above.
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.
Hi @thisisnic
I believe that for the package this is fine. I saw that the on_rosetta()
function was defined in r/R/arrow-package.R
and that should work.
However, I'm thinking of the case where the user just uses the r/R/install-arrow.R
as a standalone script, as suggested here (as it's the way I use, for example). In this way, the on_rosetta()
function is not found, as the script is not self-contained anymore.
So my proposal would be to just change the on_rosetta()
function from r/R/arrow-package.R
to r/R/install-arrow.R
, as this would not affect the former, but it would make the latter self-contained again.
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 don't see the standalone use being suggested, maybe we need to clarify the docs? As I understand it install_arrow
is for use when you have the arrow package installed but want to do one of the following:
You have arrow installed and want to upgrade to a different version
You want to try to reinstall and fix issues with Linux C++ binaries
You want to install a development build
@thisisnic please correct me if my assessment on that is wrong?
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.
@assignUser It's here: https://arrow.apache.org/docs/r/articles/install.html?q=install_arrow#using-install_arrow
Although this function is part of the arrow package, it is also available as a standalone script, so you can access it without first installing the package:
In the case of "You want to install a development build", folks may not already have arrow installed.
On a different note, there have been other PRs in this area of the codebase merged recently, so this PR may need a rebase to see how the changes affect it, and what needs doing.
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.
So my proposal would be to just change the on_rosetta() function from r/R/arrow-package.R to r/R/install-arrow.R, as this would not affect the former, but it would make the latter self-contained again.
This is a good catch, I'm working on a review, but overall I'm pro moving this function to install-arrow.R
so that it remains self-contained. Thank you for catching it!
In this way, the on_rosetta() function is not found, as the script is not self-contained anymore.
We don't have to do this here, but we should at least make an issue that we should write a test that tests that the script remains self-contained. It would have caught this bug, for example!
@thisisnic should we merge this before the release? |
@jonkeane You most recently worked on the code that this PR touches and I'm not sure where is best for this function - I don't suppose you'd mind giving this a quick look over? |
Yes, but it'll need a final change before merging |
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.
Thanks @fernandomayer for the catch + the fix. Like I mentioned in a comment up above, I'm supportive of moving the function definition to arrow-install.R
so that it can be self contained again.
Would you mind also moving the test for this from test-arrow-package.R
(and delete that file since it's the only test there) and put the test in test-install-arrow.R
?
Thanks!
r/R/install-arrow.R
Outdated
|
||
on_rosetta <- function() { | ||
identical(tolower(Sys.info()[["sysname"]]), "darwin") && | ||
identical(system("sysctl -n sysctl.proc_translated", intern = TRUE), "1") |
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.
We do actually need / want to suppressWarnings()
and ignore.stderr = TRUE
here as well. On x86 machines this call will throw a warning + print to the console complaining that it can't find the proc_translated
argument there.
identical(system("sysctl -n sysctl.proc_translated", intern = TRUE), "1") | |
identical(suppressWarnings(system("sysctl -n sysctl.proc_translated", intern = TRUE, ignore.stderr = TRUE), "1") |
@@ -267,3 +268,8 @@ wslify_path <- function(path) { | |||
end_path <- strsplit(path, drive_expr)[[1]][-1] | |||
file.path(wslified_drive, end_path) | |||
} | |||
|
|||
on_rosetta <- function() { | |||
identical(tolower(Sys.info()[["sysname"]]), "darwin") && |
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.
It would be nice to also keep this comment (though edited a bit for clarity):
identical(tolower(Sys.info()[["sysname"]]), "darwin") && | |
# make sure to suppress warnings and ignore the stderr so that this is silent on x86 | |
identical(tolower(Sys.info()[["sysname"]]), "darwin") && |
r/R/install-arrow.R
Outdated
rosetta <- identical(sysname, "darwin") && identical(system("sysctl -n sysctl.proc_translated", intern = TRUE), "1") | ||
if (rosetta) { |
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.
So my proposal would be to just change the on_rosetta() function from r/R/arrow-package.R to r/R/install-arrow.R, as this would not affect the former, but it would make the latter self-contained again.
This is a good catch, I'm working on a review, but overall I'm pro moving this function to install-arrow.R
so that it remains self-contained. Thank you for catching it!
In this way, the on_rosetta() function is not found, as the script is not self-contained anymore.
We don't have to do this here, but we should at least make an issue that we should write a test that tests that the script remains self-contained. It would have caught this bug, for example!
It looks like this would also fix a nightly fail/cran warning: https://github.com/ursacomputing/crossbow/actions/runs/6463099167/job/17545762151#step:6:3794 |
I hope you don't mind that I pushed those changes requested to this branch so that we can get this in before the upcoming release. |
@github-actions crossbow submit test-r-install-local |
Once the crossbow build is done I'm going to merge this, unless there are objections |
Revision: dfec06a Submitted crossbow builds: ursacomputing/crossbow @ actions-efacb091fb
|
I've also created #38251 to track adding a test for this self-containedness |
### Rationale for this change The latest version of `r/R/install-arrow.R` was not working properly, since it was relying on the `on_rosetta()` function, which is not defined elsewhere. I just fixed the identification of rosetta in the script. With the current code, the following gives an error ````r > source("https://raw.githubusercontent.com/apache/arrow/master/r/R/install-arrow.R") > install_arrow() Error in on_rosetta() : could not find function "on_rosetta" ```` ### What changes are included in this PR? It only removed the `on_rosetta()` function, which was not defined elsewhere, and reverted back to the `rosetta` object to identify if rosetta is present or not on a user's system. ### Are these changes tested? Yes. It was tested with the current code and the proposed PR. The proposed PR works as expected. ### Are there any user-facing changes? No. * Closes: #37907 Lead-authored-by: Fernando Mayer <[email protected]> Co-authored-by: Jonathan Keane <[email protected]> Signed-off-by: Nic Crane <[email protected]>
Thanks @jonkeane and @thisisnic I can confirm that now the command source("https://raw.githubusercontent.com/apache/arrow/main/r/R/install-arrow.R")
install_arrow() works as expected again, as stated in the documentation https://arrow.apache.org/docs/r/articles/install.html?q=install_arrow#using-install_arrow |
Thanks again @fernandomayer for the issue + PR |
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 7b7bbdc. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them. |
### Rationale for this change The latest version of `r/R/install-arrow.R` was not working properly, since it was relying on the `on_rosetta()` function, which is not defined elsewhere. I just fixed the identification of rosetta in the script. With the current code, the following gives an error ````r > source("https://raw.githubusercontent.com/apache/arrow/master/r/R/install-arrow.R") > install_arrow() Error in on_rosetta() : could not find function "on_rosetta" ```` ### What changes are included in this PR? It only removed the `on_rosetta()` function, which was not defined elsewhere, and reverted back to the `rosetta` object to identify if rosetta is present or not on a user's system. ### Are these changes tested? Yes. It was tested with the current code and the proposed PR. The proposed PR works as expected. ### Are there any user-facing changes? No. * Closes: apache#37907 Lead-authored-by: Fernando Mayer <[email protected]> Co-authored-by: Jonathan Keane <[email protected]> Signed-off-by: Nic Crane <[email protected]>
### Rationale for this change The latest version of `r/R/install-arrow.R` was not working properly, since it was relying on the `on_rosetta()` function, which is not defined elsewhere. I just fixed the identification of rosetta in the script. With the current code, the following gives an error ````r > source("https://raw.githubusercontent.com/apache/arrow/master/r/R/install-arrow.R") > install_arrow() Error in on_rosetta() : could not find function "on_rosetta" ```` ### What changes are included in this PR? It only removed the `on_rosetta()` function, which was not defined elsewhere, and reverted back to the `rosetta` object to identify if rosetta is present or not on a user's system. ### Are these changes tested? Yes. It was tested with the current code and the proposed PR. The proposed PR works as expected. ### Are there any user-facing changes? No. * Closes: apache#37907 Lead-authored-by: Fernando Mayer <[email protected]> Co-authored-by: Jonathan Keane <[email protected]> Signed-off-by: Nic Crane <[email protected]>
### Rationale for this change The latest version of `r/R/install-arrow.R` was not working properly, since it was relying on the `on_rosetta()` function, which is not defined elsewhere. I just fixed the identification of rosetta in the script. With the current code, the following gives an error ````r > source("https://raw.githubusercontent.com/apache/arrow/master/r/R/install-arrow.R") > install_arrow() Error in on_rosetta() : could not find function "on_rosetta" ```` ### What changes are included in this PR? It only removed the `on_rosetta()` function, which was not defined elsewhere, and reverted back to the `rosetta` object to identify if rosetta is present or not on a user's system. ### Are these changes tested? Yes. It was tested with the current code and the proposed PR. The proposed PR works as expected. ### Are there any user-facing changes? No. * Closes: apache#37907 Lead-authored-by: Fernando Mayer <[email protected]> Co-authored-by: Jonathan Keane <[email protected]> Signed-off-by: Nic Crane <[email protected]>
Rationale for this change
The latest version of
r/R/install-arrow.R
was not working properly, since it was relying on theon_rosetta()
function, which is not defined elsewhere. I just fixed the identification of rosetta in the script.With the current code, the following gives an error
What changes are included in this PR?
It only removed the
on_rosetta()
function, which was not defined elsewhere, and reverted back to therosetta
object to identify if rosetta is present or not on a user's system.Are these changes tested?
Yes. It was tested with the current code and the proposed PR. The proposed PR works as expected.
Are there any user-facing changes?
No.