Skip to content

Commit

Permalink
support -j in uninstall-all (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt authored May 8, 2024
1 parent d35e54c commit 10e3f92
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion features/src/rapids-build-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NVIDIA RAPIDS devcontainer build utilities",
"id": "rapids-build-utils",
"version": "24.6.15",
"version": "24.6.16",
"description": "A feature to install the RAPIDS devcontainer build utilities",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
#
# Boolean options:
# -h,--help Print this text.
# -v,--verbose Verbose output.
# -q,--quiet Less output. Option is additive, and can be
# used up to 3 times (corresponding to WARNING,
# ERROR, and CRITICAL logging levels).
# -v,--verbose Give more output. Option is additive, and can be
# used up to 3 times.
#
# Options that require values:
# -j,--parallel <num> Uninstall <num> repos in parallel.

# shellcheck disable=SC1091
. rapids-generate-docstring;
Expand All @@ -18,16 +25,20 @@ uninstall_all() {
local -;
set -euo pipefail;

eval "$(_parse_args --take '-h,--help' "$@" <&0)";
eval "$(_parse_args --take '-h,--help -j|--parallel' "$@" <&0)";

eval "$(rapids-get-num-archs-jobs-and-load --archs 0 "$@")";

# shellcheck disable=SC1091
. devcontainer-utils-debug-output 'rapids_build_utils_debug' 'uninstall-all';

for name in ${NAMES}; do
if type uninstall-${name} >/dev/null 2>&1; then
uninstall-${name} "${OPTS[@]}";
fi
done
echo ${NAMES} \
| tr '[:space:]' '\0' \
| xargs ${v:+-t} -r -0 -P${n_jobs} -I% bash -c "
if type uninstall-% >/dev/null 2>&1; then
uninstall-% ${OPTS[*]} || exit 255;
fi
";
}

uninstall_all "$@" <&0;
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
# Uninstall ${CPP_LIB}.
#
# Boolean options:
# -h,--help Print this text.
# -v,--verbose Verbose output.
# -h,--help Print this text.
# -v,--verbose Verbose output.
#
# Options that require values:
# -o,--out-dir <dir> Uninstall files from cpack'd TGZ in <dir>
Expand Down Expand Up @@ -65,7 +65,7 @@ uninstall_${CPP_LIB}_cpp() {
# shellcheck disable=SC2016
if test -n "${outd:-}"; then
local patt="cudf-.*${comp:+-$comp}-${kernel}";
_list_archive | grep -Ev '^.*/$' | xargs -rd'\n' rm -f ${v:+-v} --;
_list_archive | grep -Ev '^.*/$' | xargs -rd'\n' rm -f ${v:+-v} -- || true;
_list_archive | grep -E '^.*/$' | xargs -rd'\n' rmdir ${v:+-v} --ignore-fail-on-non-empty 2>/dev/null || true;
fi
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#
# Boolean options:
# -h,--help Print this text.
# -v,--verbose Verbose output.
# -q,--quiet Less output. Option is additive, and can be
# used up to 3 times (corresponding to WARNING,
# ERROR, and CRITICAL logging levels).
# -v,--verbose Give more output. Option is additive, and can be
# used up to 3 times.

# shellcheck disable=SC1091
. rapids-generate-docstring;
Expand All @@ -16,13 +20,13 @@ uninstall_${PY_LIB}_python() {
local -;
set -euo pipefail;

eval "$(_parse_args --take '-h,--help' "$@" <&0)";
eval "$(_parse_args --take '-h,--help -q,--quiet -v|--verbose' "$@" <&0)";

# shellcheck disable=SC1091
. devcontainer-utils-debug-output 'rapids_build_utils_debug' 'uninstall-all uninstall-${NAME} uninstall-${PY_LIB}-python';

time (
pip uninstall -y "${OPTS[@]}" "${PY_LIB}";
pip uninstall --no-input -y "${v[@]}" "${q[@]}" "${PY_LIB}" || true;
{ set +x; } 2>/dev/null; echo -n "${PY_LIB} uninstall time:";
) 2>&1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
# Uninstall ${CPP_LIB} and ${PY_LIB}.
#
# Boolean options:
# -h,--help Print this text.
# -v,--verbose Verbose output.
# -h,--help Print this text.
# -q,--quiet Less output. Option is additive, and can be
# used up to 3 times (corresponding to WARNING,
# ERROR, and CRITICAL logging levels).
# -v,--verbose Give more output. Option is additive, and can be
# used up to 3 times.

# shellcheck disable=SC1091
. rapids-generate-docstring;
Expand Down

0 comments on commit 10e3f92

Please sign in to comment.