Skip to content

Commit

Permalink
Merge branch 'branch-23.07' into doca2-rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cwharris committed May 18, 2023
2 parents aaeddb5 + 0c99762 commit f3af145
Show file tree
Hide file tree
Showing 53 changed files with 1,742 additions and 371 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci_pipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ jobs:
env:
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
PARALLEL_LEVEL: '10'
MERGE_EXAMPLES_YAML: '1'
strategy:
fail-fast: true

Expand Down Expand Up @@ -164,6 +165,8 @@ jobs:
username: '$oauthtoken'
password: ${{ secrets.NGC_API_KEY }}
image: ${{ inputs.container }}
env:
MERGE_DOCS_YAML: '1'
strategy:
fail-fast: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label-external-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
Label-Issue:
runs-on: ubuntu-latest
# Only run if the issue author is not part of NV-Morpheus
if: ${{ ! contains(fromJSON('["OWNER", "MEMBER", "CONTRIBUTOR"]'), github.event.issue.author_association)}}
if: ${{ ! contains(fromJSON('["OWNER", "MEMBER", "CONTRIBUTOR", "COLLABORATOR"]'), github.event.issue.author_association)}}
steps:
- name: add-triage-label
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: ./.github/workflows/ci_pipe.yml
with:
run_check: ${{ startsWith(github.ref_name, 'pull-request/') }}
container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-build-230414
test_container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-test-230414
container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-build-230510
test_container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-test-230510
secrets:
NGC_API_KEY: ${{ secrets.NGC_API_KEY }}
19 changes: 14 additions & 5 deletions ci/runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ RUN apt update && \
COPY ./docker/conda/environments/* /tmp/conda/

RUN CONDA_ALWAYS_YES=true /opt/conda/bin/mamba env create -n ${PROJ_NAME} -q --file /tmp/conda/cuda${CUDA_SHORT_VER}_dev.yml && \
/opt/conda/bin/mamba install -n morpheus -c conda-forge "conda-merge>=0.2" && \
sed -i "s/conda activate base/conda activate ${PROJ_NAME}/g" ~/.bashrc && \
conda clean -afy && \
rm -rf /tmp/conda
Expand All @@ -68,25 +69,33 @@ RUN apt update && \
apt clean && \
rm -rf /var/lib/apt/lists/*


# ============ test ==================
FROM base as test

# Add any test only dependencies here.

ARG PROJ_NAME
ARG CUDA_SHORT_VER

RUN apt update && \
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \
apt install --no-install-recommends -y \
nodejs \
npm \
openjdk-11-jdk && \
openjdk-11-jre-headless && \
apt clean && \
rm -rf /var/lib/apt/lists/*

COPY ./docker/conda/environments/cuda${CUDA_SHORT_VER}_examples.yml /tmp/conda/cuda${CUDA_SHORT_VER}_examples.yml

# Install extra deps needed for gnn_fraud_detection_pipeline & ransomware_detection examples
RUN CONDA_ALWAYS_YES=true /opt/conda/bin/mamba env update -n ${PROJ_NAME} -q --file /tmp/conda/cuda${CUDA_SHORT_VER}_examples.yml && \
conda clean -afy && \
source activate ${PROJ_NAME} && \
pip install --ignore-requires-python stellargraph==1.2.1 && \
rm -rf /tmp/conda

# Install camouflage needed for unittests to mock a triton server
RUN npm install -g camouflage-server@0.9 && \
RUN source activate ${PROJ_NAME} && \
npm install -g camouflage-server@0.9 && \
npm cache clean --force

# Install pytest-kafka
Expand Down
27 changes: 19 additions & 8 deletions docs/requirements.txt → ci/scripts/bootstrap_local_ci.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SPDX-FileCopyrightText: Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,10 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

breathe==4.34.0
exhale==0.3.6
ipython
myst-parser==0.17.2
nbsphinx
sphinx
sphinx_rtd_theme
export WORKSPACE_TMP="$(pwd)/ws_tmp"
mkdir -p ${WORKSPACE_TMP}
git clone ${GIT_URL} Morpheus
cd Morpheus/
git checkout ${GIT_BRANCH}
git pull

export MORPHEUS_ROOT=$(pwd)
export WORKSPACE=${MORPHEUS_ROOT}
export LOCAL_CI=1
unset CMAKE_CUDA_COMPILER_LAUNCHER
unset CMAKE_CXX_COMPILER_LAUNCHER
unset CMAKE_C_COMPILER_LAUNCHER

if [[ "${STAGE}" != "bash" ]]; then
${MORPHEUS_ROOT}/ci/scripts/github/${STAGE}.sh
fi
28 changes: 17 additions & 11 deletions ci/scripts/github/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,26 @@ cmake --version
ninja --version
sccache --version

rapids-logger "Configuring cmake for Morpheus"
git submodule update --init --recursive

cmake -B build -G Ninja ${CMAKE_BUILD_ALL_FEATURES} \
-DCCACHE_PROGRAM_PATH=$(which sccache) \
-DMORPHEUS_PYTHON_BUILD_WHEEL=ON \
-DMORPHEUS_PYTHON_BUILD_STUBS=OFF \
-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON .
CMAKE_FLAGS="${CMAKE_BUILD_ALL_FEATURES}"
CMAKE_FLAGS="${CMAKE_FLAGS} -DMORPHEUS_PYTHON_BUILD_WHEEL=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DMORPHEUS_PYTHON_BUILD_STUBS=OFF"
CMAKE_FLAGS="${CMAKE_FLAGS} -DCMAKE_BUILD_RPATH_USE_ORIGIN=ON"
if [[ "${LOCAL_CI}" == "" ]]; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCCACHE_PROGRAM_PATH=$(which sccache)"
fi

rapids-logger "Configuring cmake for Morpheus with ${CMAKE_FLAGS}"
cmake -B build -G Ninja ${CMAKE_FLAGS} .

rapids-logger "Building Morpheus"
cmake --build build --parallel ${PARALLEL_LEVEL}

rapids-logger "sccache usage for morpheus build:"
sccache --show-stats
if [[ "${LOCAL_CI}" == "" ]]; then
rapids-logger "sccache usage for morpheus build:"
sccache --show-stats
fi

rapids-logger "Archiving results"
tar cfj "${WORKSPACE_TMP}/wheel.tar.bz" build/dist
Expand All @@ -54,9 +60,9 @@ CPP_TESTS=($(find ${MORPHEUS_ROOT}/build/morpheus/_lib/tests -name "*.x" -exec r
tar cfj "${WORKSPACE_TMP}/cpp_tests.tar.bz" "${CPP_TESTS[@]}"

rapids-logger "Pushing results to ${DISPLAY_ARTIFACT_URL}"
aws s3 cp --no-progress "${WORKSPACE_TMP}/wheel.tar.bz" "${ARTIFACT_URL}/wheel.tar.bz"
aws s3 cp --no-progress "${WORKSPACE_TMP}/morhpeus_libs.tar.bz" "${ARTIFACT_URL}/morhpeus_libs.tar.bz"
aws s3 cp --no-progress "${WORKSPACE_TMP}/cpp_tests.tar.bz" "${ARTIFACT_URL}/cpp_tests.tar.bz"
upload_artifact "${WORKSPACE_TMP}/wheel.tar.bz"
upload_artifact "${WORKSPACE_TMP}/morhpeus_libs.tar.bz"
upload_artifact "${WORKSPACE_TMP}/cpp_tests.tar.bz"

rapids-logger "Success"
exit 0
12 changes: 9 additions & 3 deletions ci/scripts/github/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ ${MORPHEUS_ROOT}/ci/scripts/python_checks.sh
git submodule update --init --recursive

rapids-logger "Configuring cmake for Morpheus"
cmake -B build -G Ninja ${CMAKE_BUILD_ALL_FEATURES} -DCCACHE_PROGRAM_PATH=$(which sccache) .
CMAKE_FLAGS="${CMAKE_BUILD_ALL_FEATURES}"
if [[ "${LOCAL_CI}" == "" ]]; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCCACHE_PROGRAM_PATH=$(which sccache)"
fi
cmake -B build -G Ninja ${CMAKE_FLAGS} .

rapids-logger "Building targets that generate source code"
cmake --build build --target morpheus_style_checks --parallel ${PARALLEL_LEVEL}

rapids-logger "sccache usage for source build:"
sccache --show-stats
if [[ "${LOCAL_CI}" == "" ]]; then
rapids-logger "sccache usage for source build:"
sccache --show-stats
fi

rapids-logger "Checking versions"
${MORPHEUS_ROOT}/ci/scripts/version_checks.sh
Expand Down
116 changes: 77 additions & 39 deletions ci/scripts/github/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ rapids-logger "Memory"
rapids-logger "User Info"
id

# For PRs, $GIT_BRANCH is like: pull-request/989
REPO_NAME=$(basename "${GITHUB_REPOSITORY}")
ORG_NAME="${GITHUB_REPOSITORY_OWNER}"
PR_NUM="${GITHUB_REF_NAME##*/}"

# S3 vars
export S3_URL="s3://rapids-downloads/ci/morpheus"
export DISPLAY_URL="https://downloads.rapids.ai/ci/morpheus"
export ARTIFACT_ENDPOINT="/pull-request/${PR_NUM}/${GIT_COMMIT}/${NVARCH}"
export ARTIFACT_URL="${S3_URL}${ARTIFACT_ENDPOINT}"
export DISPLAY_ARTIFACT_URL="${DISPLAY_URL}${ARTIFACT_ENDPOINT}/"

if [[ "${LOCAL_CI}" == "1" ]]; then
export DISPLAY_ARTIFACT_URL="${LOCAL_CI_TMP}"
else
export DISPLAY_ARTIFACT_URL="${DISPLAY_URL}${ARTIFACT_ENDPOINT}/"
fi

# Set sccache env vars
export SCCACHE_S3_KEY_PREFIX=morpheus-${NVARCH}
Expand All @@ -60,29 +60,58 @@ export SCCACHE_REGION="us-east-2"
export SCCACHE_IDLE_TIMEOUT=32768
#export SCCACHE_LOG=debug

export CONDA_ENV_YML=${MORPHEUS_ROOT}/docker/conda/environments/cuda${CUDA_VER}_dev.yml
export CONDA_EXAMPLES_YML=${MORPHEUS_ROOT}/docker/conda/environments/cuda${CUDA_VER}_examples.yml
export CONDA_DOCS_YML=${MORPHEUS_ROOT}/docs/conda_docs.yml
export PIP_REQUIREMENTS=${MORPHEUS_ROOT}/docker/conda/environments/requirements.txt

export CMAKE_BUILD_ALL_FEATURES="-DCMAKE_MESSAGE_CONTEXT_SHOW=ON -DMORPHEUS_CUDA_ARCHITECTURES=60;70;75;80 -DMORPHEUS_BUILD_BENCHMARKS=ON -DMORPHEUS_BUILD_EXAMPLES=ON -DMORPHEUS_BUILD_TESTS=ON -DMORPHEUS_USE_CONDA=ON -DMORPHEUS_PYTHON_INPLACE_BUILD=OFF -DMORPHEUS_PYTHON_BUILD_STUBS=ON -DMORPHEUS_USE_CCACHE=ON"

export FETCH_STATUS=0

print_env_vars

function update_conda_env() {
rapids-logger "Checking for updates to conda env"

# Deactivate the environment first before updating
conda deactivate

# Update the packages with --prune to remove any extra packages
rapids-mamba-retry env update -n morpheus --prune -q --file ${MORPHEUS_ROOT}/docker/conda/environments/cuda${CUDA_VER}_dev.yml
ENV_YAML=${CONDA_ENV_YML}
if [[ "${MERGE_EXAMPLES_YAML}" == "1" || "${MERGE_DOCS_YAML}" == "1" ]]; then
# Merge the dev, docs and examples envs, otherwise --prune will remove the examples packages
ENV_YAML=${condatmpdir}/merged_env.yml
YAMLS="${CONDA_ENV_YML}"
if [[ "${MERGE_EXAMPLES_YAML}" == "1" ]]; then
YAMLS="${YAMLS} ${CONDA_EXAMPLES_YML}"
fi
if [[ "${MERGE_DOCS_YAML}" == "1" ]]; then
YAMLS="${YAMLS} ${CONDA_DOCS_YML}"
fi

# Conda is going to expect a requirements.txt file to be in the same directory as the env yaml
cp ${PIP_REQUIREMENTS} ${condatmpdir}/requirements.txt

rapids-logger "Merging conda envs: ${YAMLS}"
conda run -n morpheus --live-stream conda-merge ${YAMLS} > ${ENV_YAML}
fi

rapids-logger "Checking for updates to conda env"

# Update the packages
rapids-mamba-retry env update -n morpheus --prune -q --file ${ENV_YAML}

# Finally, reactivate
conda activate morpheus

rapids-logger "Final Conda Environment"
conda list
show_conda_info
}

function fetch_base_branch() {
function fetch_base_branch_gh_api() {
# For PRs, $GIT_BRANCH is like: pull-request/989
REPO_NAME=$(basename "${GITHUB_REPOSITORY}")
ORG_NAME="${GITHUB_REPOSITORY_OWNER}"
PR_NUM="${GITHUB_REF_NAME##*/}"

rapids-logger "Retrieving base branch from GitHub API"
[[ -n "$GH_TOKEN" ]] && CURL_HEADERS=('-H' "Authorization: token ${GH_TOKEN}")
RESP=$(
Expand All @@ -92,42 +121,30 @@ function fetch_base_branch() {
"${GITHUB_API_URL}/repos/${ORG_NAME}/${REPO_NAME}/pulls/${PR_NUM}"
)

BASE_BRANCH=$(echo "${RESP}" | jq -r '.base.ref')
export BASE_BRANCH=$(echo "${RESP}" | jq -r '.base.ref')

# Change target is the branch name we are merging into but due to the weird way jenkins does
# the checkout it isn't recognized by git without the origin/ prefix
export CHANGE_TARGET="origin/${BASE_BRANCH}"
rapids-logger "Base branch: ${BASE_BRANCH}"
}

function fetch_s3() {
ENDPOINT=$1
DESTINATION=$2
if [[ "${USE_S3_CURL}" == "1" ]]; then
curl -f "${DISPLAY_URL}${ENDPOINT}" -o "${DESTINATION}"
FETCH_STATUS=$?
else
aws s3 cp --no-progress "${S3_URL}${ENDPOINT}" "${DESTINATION}"
FETCH_STATUS=$?
fi
function fetch_base_branch_local() {
rapids-logger "Retrieving base branch from git"
git remote add upstream ${GIT_UPSTREAM_URL}
git fetch upstream --tags
source ${MORPHEUS_ROOT}/ci/scripts/common.sh
export BASE_BRANCH=$(get_base_branch)
export CHANGE_TARGET="upstream/${BASE_BRANCH}"
}

function restore_conda_env() {

rapids-logger "Downloading build artifacts from ${DISPLAY_ARTIFACT_URL}"
fetch_s3 "${ARTIFACT_ENDPOINT}/conda_env.tar.gz" "${WORKSPACE_TMP}/conda_env.tar.gz"
fetch_s3 "${ARTIFACT_ENDPOINT}/wheel.tar.bz" "${WORKSPACE_TMP}/wheel.tar.bz"

rapids-logger "Extracting"
mkdir -p /opt/conda/envs/morpheus

# We are using the --no-same-owner flag since user id & group id's are inconsistent between nodes in our CI pool
tar xf "${WORKSPACE_TMP}/conda_env.tar.gz" --no-same-owner --directory /opt/conda/envs/morpheus
tar xf "${WORKSPACE_TMP}/wheel.tar.bz" --no-same-owner --directory ${MORPHEUS_ROOT}
function fetch_base_branch() {
if [[ "${LOCAL_CI}" == "1" ]]; then
fetch_base_branch_local
else
fetch_base_branch_gh_api
fi

rapids-logger "Setting conda env"
conda activate morpheus
conda-unpack
rapids-logger "Base branch: ${BASE_BRANCH}"
}

function show_conda_info() {
Expand All @@ -137,3 +154,24 @@ function show_conda_info() {
conda config --show-sources
conda list --show-channel-urls
}

function upload_artifact() {
FILE_NAME=$1
BASE_NAME=$(basename "${FILE_NAME}")
rapids-logger "Uploading artifact: ${BASE_NAME}"
if [[ "${LOCAL_CI}" == "1" ]]; then
cp ${FILE_NAME} "${LOCAL_CI_TMP}/${BASE_NAME}"
else
aws s3 cp --only-show-errors "${FILE_NAME}" "${ARTIFACT_URL}/${BASE_NAME}"
fi
}

function download_artifact() {
ARTIFACT=$1
rapids-logger "Downloading ${ARTIFACT} from ${DISPLAY_ARTIFACT_URL}"
if [[ "${LOCAL_CI}" == "1" ]]; then
cp "${LOCAL_CI_TMP}/${ARTIFACT}" "${WORKSPACE_TMP}/${ARTIFACT}"
else
aws s3 cp --only-show-errors "${ARTIFACT_URL}/${ARTIFACT}" "${WORKSPACE_TMP}/${ARTIFACT}"
fi
}
7 changes: 2 additions & 5 deletions ci/scripts/github/docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source ${WORKSPACE}/ci/scripts/github/common.sh

update_conda_env

aws s3 cp --no-progress "${ARTIFACT_URL}/wheel.tar.bz" "${WORKSPACE_TMP}/wheel.tar.bz"
download_artifact "wheel.tar.bz"

tar xf "${WORKSPACE_TMP}/wheel.tar.bz"

Expand All @@ -32,9 +32,6 @@ cd ${MORPHEUS_ROOT}
git lfs install
${MORPHEUS_ROOT}/scripts/fetch_data.py fetch docs examples

rapids-logger "Installing Documentation dependencies"
mamba env update -f ${MORPHEUS_ROOT}/docs/conda_docs.yml

git submodule update --init --recursive

rapids-logger "Configuring for docs"
Expand All @@ -47,7 +44,7 @@ rapids-logger "Archiving the docs"
tar cfj "${WORKSPACE_TMP}/docs.tar.bz" build/docs/html

rapids-logger "Pushing results to ${DISPLAY_ARTIFACT_URL}"
aws s3 cp --no-progress "${WORKSPACE_TMP}/docs.tar.bz" "${ARTIFACT_URL}/docs.tar.bz"
upload_artifact "${WORKSPACE_TMP}/docs.tar.bz"

rapids-logger "Success"
exit 0
Loading

0 comments on commit f3af145

Please sign in to comment.