Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit c8b7f97

Browse files
committed
[SPARK-22377][BUILD] Use /usr/sbin/lsof if lsof does not exists in release-build.sh
## What changes were proposed in this pull request? This PR proposes to use `/usr/sbin/lsof` if `lsof` is missing in the path to fix nightly snapshot jenkins jobs. Please refer apache#19359 (comment): > Looks like some of the snapshot builds are having lsof issues: > > https://amplab.cs.berkeley.edu/jenkins/view/Spark%20Packaging/job/spark-branch-2.1-maven-snapshots/182/console > >https://amplab.cs.berkeley.edu/jenkins/view/Spark%20Packaging/job/spark-branch-2.2-maven-snapshots/134/console > >spark-build/dev/create-release/release-build.sh: line 344: lsof: command not found >usage: kill [ -s signal | -p ] [ -a ] pid ... >kill -l [ signal ] Up to my knowledge, the full path of `lsof` is required for non-root user in few OSs. ## How was this patch tested? Manually tested as below: ```bash #!/usr/bin/env bash LSOF=lsof if ! hash $LSOF 2>/dev/null; then echo "a" LSOF=/usr/sbin/lsof fi $LSOF -P | grep "a" ``` Author: hyukjinkwon <[email protected]> Closes apache#19695 from HyukjinKwon/SPARK-22377.
1 parent f7534b3 commit c8b7f97

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dev/create-release/release-build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ else
130130
fi
131131
fi
132132

133+
# This is a band-aid fix to avoid the failure of Maven nightly snapshot in some Jenkins
134+
# machines by explicitly calling /usr/sbin/lsof. Please see SPARK-22377 and the discussion
135+
# in its pull request.
136+
LSOF=lsof
137+
if ! hash $LSOF 2>/dev/null; then
138+
LSOF=/usr/sbin/lsof
139+
fi
133140

134141
if [ -z "$SPARK_PACKAGE_VERSION" ]; then
135142
SPARK_PACKAGE_VERSION="${SPARK_VERSION}-$(date +%Y_%m_%d_%H_%M)-${git_hash}"
@@ -345,7 +352,7 @@ if [[ "$1" == "publish-snapshot" ]]; then
345352
# -DskipTests $SCALA_2_12_PROFILES $PUBLISH_PROFILES clean deploy
346353

347354
# Clean-up Zinc nailgun process
348-
lsof -P |grep $ZINC_PORT | grep LISTEN | awk '{ print $2; }' | xargs kill
355+
$LSOF -P |grep $ZINC_PORT | grep LISTEN | awk '{ print $2; }' | xargs kill
349356

350357
rm $tmp_settings
351358
cd ..
@@ -382,7 +389,7 @@ if [[ "$1" == "publish-release" ]]; then
382389
# -DskipTests $SCALA_2_12_PROFILES §$PUBLISH_PROFILES clean install
383390

384391
# Clean-up Zinc nailgun process
385-
lsof -P |grep $ZINC_PORT | grep LISTEN | awk '{ print $2; }' | xargs kill
392+
$LSOF -P |grep $ZINC_PORT | grep LISTEN | awk '{ print $2; }' | xargs kill
386393

387394
#./dev/change-scala-version.sh 2.11
388395

0 commit comments

Comments
 (0)