celeborn/dev/dependencies.sh
SteNicholas adaa96fc60 [CELEBORN-1310][FLINK] Support Flink 1.19
### What changes were proposed in this pull request?

Support Flink 1.19.

### Why are the changes needed?

Flink 1.19.0 is announced to release: [Announcing the Release of Apache Flink 1.19] (https://flink.apache.org/2024/03/18/announcing-the-release-of-apache-flink-1.19).

The main changes includes:

- `org.apache.flink.runtime.io.network.partition.consumer.RemoteInputChannel` constructor change parameters:
   - `consumedSubpartitionIndex` changes to `consumedSubpartitionIndexSet`: [[FLINK-33743][runtime] Support consuming multiple subpartitions on a single channel](https://github.com/apache/flink/pull/23927).
   - adds `partitionRequestListenerTimeout`: [[FLINK-25055][network] Support listen and notify mechanism for partition request](https://github.com/apache/flink/pull/23565).
- `org.apache.flink.runtime.io.network.partition.consumer.SingleInputGate` constructor removes parameters `subpartitionIndexRange`, `tieredStorageConsumerClient`, `nettyService` and `tieredStorageConsumerSpecs`: [[FLINK-33743][runtime] Support consuming multiple subpartitions on a single channel](https://github.com/apache/flink/pull/23927).
- Change the default config file to `config.yaml` in `flink-dist`: [[FLINK-33577][dist] Change the default config file to config.yaml in flink-dist](https://github.com/apache/flink/pull/24177).
- `org.apache.flink.configuration.RestartStrategyOptions` uses `org.apache.commons.compress.utils.Sets` of `commons-compress` dependency: [[FLINK-33865][runtime] Adding an ITCase to ensure exponential-delay.attempts-before-reset-backoff works well](https://github.com/apache/flink/pull/23942).

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Local test:

- Flink batch job submission

```
$ ./bin/flink run examples/streaming/WordCount.jar --execution-mode BATCH
Executing example with default input data.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
Job has been submitted with JobID 2e9fb659991a9c29d376151783bdf6de
Program execution finished
Job with JobID 2e9fb659991a9c29d376151783bdf6de has finished.
Job Runtime: 1912 ms
```

- Flink batch job execution

![image](https://github.com/apache/incubator-celeborn/assets/10048174/18b60861-cafc-4df3-b94d-93307e728be2)

- Celeborn master log
```

24/03/18 20:52:47,513 INFO [celeborn-dispatcher-42] Master: Offer slots successfully for 1 reducers of 1710766312631-2e9fb659991a9c29d376151783bdf6de-0 on 1 workers.
```

- Celeborn worker log
```
24/03/18 20:52:47,704 INFO [celeborn-dispatcher-1] StorageManager: created file at /Users/nicholas/Software/Celeborn/apache-celeborn-0.5.0-SNAPSHOT/shuffle/celeborn-worker/shuffle_data/1710766312631-2e9fb659991a9c29d376151783bdf6de/0/0-0-0
24/03/18 20:52:47,707 INFO [celeborn-dispatcher-1] Controller: Reserved 1 primary location and 0 replica location for 1710766312631-2e9fb659991a9c29d376151783bdf6de-0
24/03/18 20:52:47,874 INFO [celeborn-dispatcher-2] Controller: Start commitFiles for 1710766312631-2e9fb659991a9c29d376151783bdf6de-0
24/03/18 20:52:47,890 INFO [worker-rpc-async-replier] Controller: CommitFiles for 1710766312631-2e9fb659991a9c29d376151783bdf6de-0 success with 1 committed primary partitions, 0 empty primary partitions, 0 failed primary partitions, 0 committed replica partitions, 0 empty replica partitions, 0 failed replica partitions.
```

Closes #2399 from SteNicholas/CELEBORN-1310.

Authored-by: SteNicholas <programgeek@163.com>
Signed-off-by: Shuang <lvshuang.xjs@alibaba-inc.com>
2024-03-20 11:51:23 +08:00

256 lines
7.2 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -ex
# Explicitly set locale in order to make `sort` output consistent across machines.
# See https://stackoverflow.com/questions/28881 for more details.
export LC_ALL=C
PWD=$(cd "$(dirname "$0")"/.. || exit; pwd)
MVN="${PWD}/build/mvn"
SBT="${PWD}/build/sbt"
SBT_ENABLED="false"
REPLACE="false"
CHECK="false"
MODULE=""
DEP_PR=""
DEP=""
function mvn_build_classpath() {
$MVN -P$MODULE clean install -DskipTests -am -pl $MVN_MODULES
$MVN -P$MODULE dependency:build-classpath -am -pl $MVN_MODULES | \
grep -A1 "Dependencies classpath:" | \
grep -v "^--$" | \
grep -v "Dependencies classpath:" | \
grep -v '^$' | \
tr ":" "\n" | \
awk -F '/' '{
artifact_id=$(NF-2);
version=$(NF-1);
jar_name=$NF;
classifier_start_index=length(artifact_id"-"version"-") + 1;
classifier_end_index=index(jar_name, ".jar") - 1;
classifier=substr(jar_name, classifier_start_index, classifier_end_index - classifier_start_index + 1);
print artifact_id"/"version"/"classifier"/"jar_name
}' | grep -v "celeborn" | sort -u >> "${DEP_PR}"
}
function sbt_build_client_classpath() {
PATTERN="$SBT_PROJECT / Runtime / managedClasspath"
deps=$(
$SBT -P$MODULE "clean; export Runtime/managedClasspath" | \
awk -v pat="$PATTERN" '$0 ~ pat { found=1 } found { print }' | \
awk 'NR==2' | \
tr ":" "\n"
)
deps1=$(echo "$deps" | grep -v ".sbt")
deps2=$(echo "$deps" | grep ".sbt" || true)
result1=$(
echo "$deps1" | \
awk -F '/' '{
artifact_id=$(NF-2);
version=$(NF-1);
jar_name=$NF;
classifier_start_index=length(artifact_id"-"version"-") + 1;
classifier_end_index=index(jar_name, ".jar") - 1;
classifier=substr(jar_name, classifier_start_index, classifier_end_index - classifier_start_index + 1);
print artifact_id"/"version"/"classifier"/"jar_name
}'
)
# TODO: a temporary workaround for parsing the dependency in the directory `.sbt`,
# need to migrate this to the SBT plugin.
version_pattern="scala-([0-9]+\.[0-9]+\.[0-9]+)"
file_pattern="/([^/]+)\.jar"
result2=()
while IFS= read -r line; do
if [[ -n "$line" ]]; then
[[ $line =~ $version_pattern ]] && version_info="${BASH_REMATCH[1]}";
[[ $line =~ $file_pattern ]] && file_name="${BASH_REMATCH[1]}";
result2+=("$file_name/$version_info//$file_name-$version_info.jar")
fi
done <<< "$deps2"
result=("${result1[@]}" "${result2[@]}")
echo "${result[@]}" | tr ' ' '\n' | sort -u >> "${DEP_PR}"
}
function sbt_build_server_classpath() {
$SBT "error; clean; export managedClasspath" | \
awk '/managedClasspath/ { found=1 } found { print }' | \
awk 'NR % 2 == 0' | \
# This will skip the last line
sed '$d' | \
tr ":" "\n" | \
awk -F '/' '{
artifact_id=$(NF-2);
version=$(NF-1);
jar_name=$NF;
classifier_start_index=length(artifact_id"-"version"-") + 1;
classifier_end_index=index(jar_name, ".jar") - 1;
classifier=substr(jar_name, classifier_start_index, classifier_end_index - classifier_start_index + 1);
print artifact_id"/"version"/"classifier"/"jar_name
}' | sort -u >> "${DEP_PR}"
}
function check_diff() {
set +e
the_diff=$(diff "${DEP}" "${DEP_PR}")
set -e
rm -rf "${DEP_PR}"
if [[ -n "${the_diff}" ]]; then
echo "Dependency List Changed Detected: "
echo "${the_diff}"
echo "To update the dependency file, run './dev/dependencies.sh --replace'."
exit 1
fi
}
function exit_with_usage() {
echo "Usage: $0 [--sbt | --mvn] [--replace] [--check] [--module MODULE_VALUE] [--help]"
exit 1
}
# Parse arguments
while (( "$#" )); do
case $1 in
--sbt)
SBT_ENABLED="true"
;;
--mvn)
SBT_ENABLED="false"
;;
--replace)
REPLACE="true"
;;
--check)
CHECK="true"
;;
--module) # Support for --module parameter
shift
MODULE="$1"
;;
--help)
exit_with_usage
;;
--*)
echo "Error: $1 is not supported"
exit_with_usage
;;
*)
echo "Error: $1 is not supported"
exit_with_usage
;;
esac
shift
done
case "$MODULE" in
"spark-2.4")
MVN_MODULES="client-spark/spark-2"
SBT_PROJECT="celeborn-client-spark-2"
;;
"spark-3"*) # Match all versions starting with "spark-3"
MVN_MODULES="client-spark/spark-3"
SBT_PROJECT="celeborn-client-spark-3"
;;
"flink-1.14")
MVN_MODULES="client-flink/flink-1.14"
SBT_PROJECT="celeborn-client-flink-1_14"
;;
"flink-1.15")
MVN_MODULES="client-flink/flink-1.15"
SBT_PROJECT="celeborn-client-flink-1_15"
;;
"flink-1.17")
MVN_MODULES="client-flink/flink-1.17"
SBT_PROJECT="celeborn-client-flink-1_17"
;;
"flink-1.18")
MVN_MODULES="client-flink/flink-1.18"
SBT_PROJECT="celeborn-client-flink-1_18"
;;
"flink-1.19")
MVN_MODULES="client-flink/flink-1.19"
SBT_PROJECT="celeborn-client-flink-1_19"
;;
"mr")
MVN_MODULES="client-mr/mr"
SBT_PROJECT="celeborn-client-mr"
;;
*)
MODULE="server"
MVN_MODULES="worker,master"
;;
esac
if [ "$MODULE" = "server" ]; then
DEP="${PWD}/dev/deps/dependencies-server"
DEP_PR="${PWD}/dev/deps/dependencies-server.tmp"
else
DEP="${PWD}/dev/deps/dependencies-client-$MODULE"
DEP_PR="${PWD}/dev/deps/dependencies-client-$MODULE.tmp"
fi
rm -rf "${DEP_PR}"
cat >"${DEP_PR}"<<EOF
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
EOF
if [ "$SBT_ENABLED" == "true" ]; then
if [ "$MODULE" == "server" ]; then
sbt_build_server_classpath
else
sbt_build_client_classpath
fi
else
mvn_build_classpath
fi
if [ "$REPLACE" == "true" ]; then
rm -rf "${DEP}"
mv "${DEP_PR}" "${DEP}"
exit 0
fi
if [ "$CHECK" == "true" ]; then
check_diff
fi