Skip to content

Commit

Permalink
Enable wheels CI scripts to run locally (#57)
Browse files Browse the repository at this point in the history
Taking inspiration from #35 and #62

This PR adds / updates:

- `rapids-configure-sccache` (new) : configures sccache for CI/local,
with the intention being to remove this information from CI containers
- `rapids-date-string` (new) : configures date string
- `rapids-configure-conda-channels` (new) : modifies conda channels
based on build type
- `rapids-env-update` (modified) : calls the `rapids-configure-sccache`
- `rapids-prompt-local-repo-config` (new) : consolidates prompts for
users to configure repo information locally
- `rapids-download-wheels/conda-from-s3` (updated) : uses
`rapids-prompt-local-repo-config`
- `rapids-upload-wheels-to-s3` (modifed) : guards to ensure local builds
don't try to upload
  • Loading branch information
divyegala authored Jul 19, 2023
1 parent a5bf4ac commit 71f9e9a
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 92 deletions.
8 changes: 8 additions & 0 deletions tools/rapids-configure-conda-channels
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# A utility script that configures conda channels

# Remove nightly channels if build is a release build
if rapids-is-release-build; then
conda config --system --remove channels rapidsai-nightly
conda config --system --remove channels dask/label/dev
fi
17 changes: 17 additions & 0 deletions tools/rapids-configure-sccache
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# A utility script that configures sccache environment variables

export CMAKE_CUDA_COMPILER_LAUNCHER=sccache
export CMAKE_CXX_COMPILER_LAUNCHER=sccache
export CMAKE_C_COMPILER_LAUNCHER=sccache
export SCCACHE_BUCKET=rapids-sccache-east
export SCCACHE_REGION=us-east-2
export SCCACHE_IDLE_TIMEOUT=32768
export SCCACHE_S3_USE_SSL=true
export SCCACHE_S3_NO_CREDENTIALS=false
if [ "${CI:-false}" = "false" ]; then
# Configure sccache for read-only mode since no credentials
# are available in local builds.
export SCCACHE_S3_NO_CREDENTIALS=true
export PARALLEL_LEVEL=${PARALLEL_LEVEL:-$(nproc)}
fi
9 changes: 9 additions & 0 deletions tools/rapids-date-string
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# A utility script produces a date string

RAPIDS_DATE_STRING="$(date +%y%m%d)"
if [ "${GITHUB_ACTIONS:-false}" = "true" ]; then
WORKFLOW_DATE=$(rapids-retry gh run view "${GITHUB_RUN_ID}" --json createdAt | jq -r '.createdAt')
RAPIDS_DATE_STRING=$(date -d "${WORKFLOW_DATE}" +%y%m%d)
fi
export RAPIDS_DATE_STRING
75 changes: 1 addition & 74 deletions tools/rapids-download-conda-from-s3
Original file line number Diff line number Diff line change
Expand Up @@ -19,80 +19,7 @@ case "${pkg_type}" in
;;
esac


if [ "${CI:-false}" = "false" ]; then
rapids-echo-stderr "Local run detected."
rapids-echo-stderr "NVIDIA VPN connectivity is required to download workflow artifacts."

if [ -z "${RAPIDS_BUILD_TYPE:-}" ]; then
{
echo ""
read -r -p "Enter workflow type (one of: pull-request|branch|nightly): " RAPIDS_BUILD_TYPE
export RAPIDS_BUILD_TYPE
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_BUILD_TYPE' environment variable:"
echo "export RAPIDS_BUILD_TYPE=${RAPIDS_BUILD_TYPE}"
echo ""
} >&2
fi

if [ -z "${RAPIDS_REPOSITORY:-}" ]; then
{
echo ""
read -r -p "Enter org/repository name (e.g. rapidsai/cudf): " RAPIDS_REPOSITORY
export RAPIDS_REPOSITORY
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_REPOSITORY' environment variable:"
echo "export RAPIDS_REPOSITORY=${RAPIDS_REPOSITORY}"
echo ""
} >&2
fi

if [ -z "${RAPIDS_REF_NAME:-}" ]; then
{
echo ""
if [ "${RAPIDS_BUILD_TYPE}" = "pull-request" ]; then
read -r -p "Enter pull-request number (e.g. 1546): " PR_NUMBER
RAPIDS_REF_NAME=pull-request/${PR_NUMBER}
else
read -r -p "Enter branch name (e.g. branch-23.08): " RAPIDS_REF_NAME
fi
export RAPIDS_REF_NAME
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_REF_NAME' environment variable:"
echo "export RAPIDS_REF_NAME=${RAPIDS_REF_NAME}"
echo ""
} >&2
fi

if [ -z "${RAPIDS_SHA:-}" ]; then
{
echo ""
if RAPIDS_SHA=$(set -e; git rev-parse HEAD 2> /dev/null); then
echo "Using HEAD commit for artifact commit hash. Overwrite this by setting the 'RAPIDS_SHA' environment variable:"
echo "export RAPIDS_SHA=${RAPIDS_SHA}"
else
echo "There was a problem acquiring the HEAD commit sha from the current directory."
echo "Suppress this prompt in the future by ensuring the current directory is the '${RAPIDS_REPOSITORY}' git repository."
read -r -p "Enter full commit sha (e.g. f15776cc449b0c8345f044f713c9c06eb13622f3): " RAPIDS_SHA
fi
echo ""
export RAPIDS_SHA
} >&2
fi

if [ "${RAPIDS_BUILD_TYPE}" = "nightly" ] && [ -z "${RAPIDS_NIGHTLY_DATE:-}" ]; then
{
echo ""
read -r -p "Enter nightly date (e.g. 2023-06-20): " RAPIDS_NIGHTLY_DATE
export RAPIDS_NIGHTLY_DATE
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_NIGHTLY_DATE' environment variable:"
echo "export RAPIDS_NIGHTLY_DATE=${RAPIDS_NIGHTLY_DATE}"
echo ""
} >&2
fi
fi
source rapids-prompt-local-repo-config

# Prepare empty dir to extract tarball to
channel="/tmp/${pkg_type}_channel"
Expand Down
2 changes: 2 additions & 0 deletions tools/rapids-download-wheels-from-s3
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# 1) dest dir to download and extract wheels to
set -eo pipefail

source rapids-prompt-local-repo-config

pkg_name="$(rapids-package-name wheel_python)"

rapids-download-from-s3 "${pkg_name}" "$@"
21 changes: 3 additions & 18 deletions tools/rapids-env-update
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@
# a nightly or stable build is occurring.
set -euo pipefail

# Remove nightly channels if build is a release build
if rapids-is-release-build; then
conda config --system --remove channels rapidsai-nightly
conda config --system --remove channels dask/label/dev
fi
rapids-configure-conda-channels

if [ "${CI:-false}" = "false" ]; then
# Configure sccache for read-only mode since no credentials
# are available in local builds.
export SCCACHE_S3_NO_CREDENTIALS=true
export PARALLEL_LEVEL=${PARALLEL_LEVEL:-$(nproc)}
export RAPIDS_BUILD_TYPE=${RAPIDS_BUILD_TYPE:-"pull-request"}
fi
source rapids-configure-sccache

RAPIDS_DATE_STRING="$(date +%y%m%d)"
if [ "${GITHUB_ACTIONS:-false}" = "true" ]; then
WORKFLOW_DATE=$(rapids-retry gh run view "${GITHUB_RUN_ID}" --json createdAt | jq -r '.createdAt')
RAPIDS_DATE_STRING=$(date -d "${WORKFLOW_DATE}" +%y%m%d)
fi
export RAPIDS_DATE_STRING
source rapids-date-string
77 changes: 77 additions & 0 deletions tools/rapids-prompt-local-repo-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
# A utility script that prompts user to setup repository information in
# local environments

if [ "${CI:-false}" = "false" ]; then
rapids-echo-stderr "Local run detected."
rapids-echo-stderr "NVIDIA VPN connectivity is required to download workflow artifacts."

if [ -z "${RAPIDS_BUILD_TYPE:-}" ]; then
{
echo ""
read -r -p "Enter workflow type (one of: pull-request|branch|nightly): " RAPIDS_BUILD_TYPE
export RAPIDS_BUILD_TYPE
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_BUILD_TYPE' environment variable:"
echo "export RAPIDS_BUILD_TYPE=${RAPIDS_BUILD_TYPE}"
echo ""
} >&2
fi

if [ -z "${RAPIDS_REPOSITORY:-}" ]; then
{
echo ""
read -r -p "Enter org/repository name (e.g. rapidsai/cudf): " RAPIDS_REPOSITORY
export RAPIDS_REPOSITORY
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_REPOSITORY' environment variable:"
echo "export RAPIDS_REPOSITORY=${RAPIDS_REPOSITORY}"
echo ""
} >&2
fi

if [ -z "${RAPIDS_REF_NAME:-}" ]; then
{
echo ""
if [ "${RAPIDS_BUILD_TYPE}" = "pull-request" ]; then
read -r -p "Enter pull-request number (e.g. 1546): " PR_NUMBER
RAPIDS_REF_NAME=pull-request/${PR_NUMBER}
else
read -r -p "Enter branch name (e.g. branch-23.08): " RAPIDS_REF_NAME
fi
export RAPIDS_REF_NAME
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_REF_NAME' environment variable:"
echo "export RAPIDS_REF_NAME=${RAPIDS_REF_NAME}"
echo ""
} >&2
fi

if [ -z "${RAPIDS_SHA:-}" ]; then
{
echo ""
if RAPIDS_SHA=$(set -e; git rev-parse HEAD 2> /dev/null); then
echo "Using HEAD commit for artifact commit hash. Overwrite this by setting the 'RAPIDS_SHA' environment variable:"
echo "export RAPIDS_SHA=${RAPIDS_SHA}"
else
echo "There was a problem acquiring the HEAD commit sha from the current directory."
echo "Suppress this prompt in the future by ensuring the current directory is the '${RAPIDS_REPOSITORY}' git repository."
read -r -p "Enter full commit sha (e.g. f15776cc449b0c8345f044f713c9c06eb13622f3): " RAPIDS_SHA
fi
echo ""
export RAPIDS_SHA
} >&2
fi

if [ "${RAPIDS_BUILD_TYPE}" = "nightly" ] && [ -z "${RAPIDS_NIGHTLY_DATE:-}" ]; then
{
echo ""
read -r -p "Enter nightly date (e.g. 2023-06-20): " RAPIDS_NIGHTLY_DATE
export RAPIDS_NIGHTLY_DATE
echo ""
echo "Suppress this prompt in the future by setting the 'RAPIDS_NIGHTLY_DATE' environment variable:"
echo "export RAPIDS_NIGHTLY_DATE=${RAPIDS_NIGHTLY_DATE}"
echo ""
} >&2
fi
fi
6 changes: 6 additions & 0 deletions tools/rapids-upload-wheels-to-s3
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
# 1) wheel path to tar up
set -e

if [ "${CI:-false}" = "false" ]; then
rapids-echo-stderr "Packages from local builds cannot be uploaded to S3."
rapids-echo-stderr "Open a PR to have successful builds uploaded."
exit 0
fi

pkg_name="$(rapids-package-name wheel_python)"

rapids-upload-to-s3 "${pkg_name}" "$@"

0 comments on commit 71f9e9a

Please sign in to comment.