Skip to content

Commit

Permalink
ARROW-13215: [R] [CI] Add ENV TZ to docker files
Browse files Browse the repository at this point in the history
Closes apache#10703 from jonkeane/ARROW-13215-tz-in-docker

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Neal Richardson <[email protected]>
  • Loading branch information
jonkeane authored and nealrichardson committed Jul 15, 2021
1 parent 5a86d53 commit c56b6e3
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ GCC_VERSION=""
R_ORG=rhub
R_IMAGE=ubuntu-gcc-release
R_TAG=latest
TZ=UTC
# -1 does not attempt to install a devtoolset version, any positive integer will install devtoolset-n
DEVTOOLSET_VERSION=-1

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ jobs:
run: |
sudo sysctl -w kernel.core_pattern="core.%e.%p"
ulimit -c unlimited
archery docker run ubuntu-r
# Setting a non-default and non-probable Marquesas French Polynesia time
# it has both with a .45 offset and very very few people who live there.
archery docker run -e TZ=MART ubuntu-r
- name: Dump install logs
run: cat r/check/arrow.Rcheck/00install.out
if: always()
Expand Down Expand Up @@ -147,7 +149,10 @@ jobs:
run: |
sudo sysctl -w kernel.core_pattern="core.%e.%p"
ulimit -c unlimited
archery docker run r
# Don't set a TZ here to test that case. These builds will have the following warning in them:
# System has not been booted with systemd as init system (PID 1). Can't operate.
# Failed to connect to bus: Host is down
archery docker run -e TZ="" r
- name: Dump install logs
run: cat r/check/arrow.Rcheck/00install.out
if: always()
Expand Down
3 changes: 3 additions & 0 deletions ci/docker/linux-apt-r.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ ARG base
FROM ${base}
ARG arch

ARG tz="UTC"
ENV TZ=${tz}

# Build R
# [1] https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04
# [2] https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/#installing-r-packages-from-cran
Expand Down
3 changes: 3 additions & 0 deletions ci/docker/linux-r.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ENV ARROW_R_DEV=${r_dev}
ARG devtoolset_version=-1
ENV DEVTOOLSET_VERSION=${devtoolset_version}

ARG tz="UTC"
ENV TZ=${tz}

# Make sure R is on the path for the R-hub devel versions (where RPREFIX is set in its dockerfile)
ENV PATH "${RPREFIX}/bin:${PATH}"

Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,7 @@ services:
r: ${R}
base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp
gcc_version: ${GCC_VERSION}
tz: ${TZ}
shm_size: *shm-size
environment:
<<: *ccache
Expand Down Expand Up @@ -1048,6 +1049,7 @@ services:
base: ${R_ORG}/${R_IMAGE}:${R_TAG}
r_dev: ${ARROW_R_DEV}
devtoolset_version: ${DEVTOOLSET_VERSION}
tz: ${TZ}
shm_size: *shm-size
environment:
LIBARROW_DOWNLOAD: "false"
Expand Down Expand Up @@ -1078,6 +1080,7 @@ services:
args:
base: wch1/r-debug:latest
r_bin: RDsan
tz: ${TZ}
environment:
<<: *ccache
volumes: *ubuntu-volumes
Expand All @@ -1099,6 +1102,7 @@ services:
args:
base: wch1/r-debug:latest
r_bin: RDvalgrind
tz: ${TZ}
environment:
<<: *ccache
ARROW_R_DEV: ${ARROW_R_DEV}
Expand All @@ -1123,6 +1127,7 @@ services:
args:
base: rstudio/r-base:4.0-focal
r_dev: ${ARROW_R_DEV}
tz: ${TZ}
shm_size: *shm-size
environment:
LIBARROW_DOWNLOAD: "true"
Expand Down
4 changes: 2 additions & 2 deletions r/tests/testthat/test-Array.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ test_that("Timezone handling in Arrow roundtrip (ARROW-3543)", {
# Write a feather file as that's what the initial bug report used
df <- tibble::tibble(
no_tz = lubridate::ymd_hms("2018-10-07 19:04:05") + 1:10,
yes_tz = lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Asia/Pyongyang") + 1:10
yes_tz = lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Pacific/Marquesas") + 1:10
)
if (!identical(Sys.timezone(), "Asia/Pyongyang")) {
if (!identical(Sys.timezone(), "Pacific/Marquesas")) {
# Confirming that the columns are in fact different
expect_false(any(df$no_tz == df$yes_tz))
}
Expand Down
2 changes: 1 addition & 1 deletion r/tests/testthat/test-data-type.R
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ test_that("FixedSizeBinary", {
})

test_that("DataType to C-interface", {
datatype <- timestamp("ms", timezone = "Asia/Pyongyang")
datatype <- timestamp("ms", timezone = "Pacific/Marquesas")

# export the datatype via the C-interface
ptr <- allocate_arrow_schema()
Expand Down
2 changes: 1 addition & 1 deletion r/tests/testthat/test-dplyr-lubridate.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_df <- tibble::tibble(date = test_date)
# We can support this feature after ARROW-12980 is merged
test_that("timezone aware timestamps are not supported", {

tz_aware_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz = "Asia/Pyongyang")
tz_aware_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz = "Pacific/Marquesas")
tz_aware_df <- tibble::tibble(date = tz_aware_date)

expect_error(
Expand Down
2 changes: 1 addition & 1 deletion r/tests/testthat/test-python.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ test_that("Table with metadata roundtrip", {
})

test_that("DataType roundtrip", {
r <- timestamp("ms", timezone = "Asia/Pyongyang")
r <- timestamp("ms", timezone = "Pacific/Marquesas")
py <- reticulate::r_to_py(r)
expect_s3_class(py, "pyarrow.lib.DataType")
expect_equal(reticulate::py_to_r(py), r)
Expand Down

0 comments on commit c56b6e3

Please sign in to comment.