dongjoon-hyun commented on code in PR #60328:
URL: https://github.com/apache/spark/pull/60328#discussion_r4540619614


##########
.github/workflows/maven_test.yml:
##########
@@ -220,15 +215,11 @@ jobs:
           python3.12 -m pip list
       - name: Download precompiled artifact
         id: download-precompiled
-        if: needs.precompile-maven.result == 'success'
-        continue-on-error: true
         uses: actions/download-artifact@v8

Review Comment:
   **[2] Without the fallback, `retention-days: 1` breaks "Re-run failed jobs" 
after a day.**
   
   The compile artifact is still uploaded with `retention-days: 1` (L110, and 
`python_hosted_runner_test.yml` L101). "Re-run failed jobs" does not re-run the 
successful precompile job, so a shard re-run more than a day later fails at 
this step with "Artifact not found". Before this PR, it fell back to `mvn clean 
install`. These runs are weekly on ARM and macOS, so a flaky shard that someone 
notices a few days later can now only be recovered with "Re-run all jobs", 
which repeats the precompile and all 12 shards. Could the retention cover at 
least a few days (for example, `retention-days: 7`) so a failed shard can still 
be re-run alone?



##########
.github/workflows/maven_test.yml:
##########
@@ -53,14 +53,10 @@ on:
         default: '{}'
 jobs:
   # Precompile Spark with Maven once and publish target/ + ~/.m2/.../spark as
-  # an artifact for the matrix entries below to consume. Optional: any failure
-  # here degrades the matrix to its original local `clean install` path.
+  # an artifact for the matrix entries below to consume.
   precompile-maven:

Review Comment:
   **[1] A transient failure in this job now skips every shard, and these runs 
are scheduled.**
   
   All six callers of this workflow and of `python_hosted_runner_test.yml` 
(where the same `continue-on-error` is removed at L61) run on a cron schedule, 
the ARM and macOS ones weekly, so nobody may be around to re-run a failed run. 
Run [32041418506](https://github.com/apache/spark/actions/runs/32041418506), 
which the PR description cites, failed in this job at "Upload compile artifact" 
with "The server is busy" and was not re-run (attempt 1). The fallback still 
gave three green shards there (`sql#hive` slow tests, `sql#hive` other tests, 
and the connector shard). With this PR, that week's ARM Maven run would have 
had no test results at all.
   
   Could we keep the hard requirement but retry the transient part? For 
example, the upload step could get an `id` and `continue-on-error: true`, 
followed by a second upload with `overwrite: true` that runs only when the 
first one's `outcome` is `failure`.



##########
.github/workflows/maven_test.yml:
##########
@@ -220,15 +215,11 @@ jobs:
           python3.12 -m pip list
       - name: Download precompiled artifact
         id: download-precompiled
-        if: needs.precompile-maven.result == 'success'
-        continue-on-error: true
         uses: actions/download-artifact@v8
         with:
           name: spark-maven-compile-${{ inputs.branch }}-java${{ matrix.java 
}}-${{ github.run_id }}
       - name: Extract precompiled artifact
         id: extract-precompiled
-        if: steps.download-precompiled.outcome == 'success'
-        continue-on-error: true
         run: |
           zstd -dc compile-target.tar.zst | tar -xf -

Review Comment:
   **[3] This pipeline runs without `pipefail`, so a `zstd` failure can go 
unnoticed.**
   
   The step sets no `shell:`, so it runs under the default `bash -e {0}`, which 
has no `pipefail`, and the exit code of the pipeline is that of `tar` alone. If 
`zstd` fails, for example on a checksum mismatch that it reports only after 
writing the data, or on a truncated stream that ends at a member boundary, 
`tar` can still exit 0. The step then passes and the tests run on a corrupt or 
partial tree, while the PR description says that extraction failures now fail 
the shard. L228 and `python_hosted_runner_test.yml` L184 are the same. Could 
these steps use `shell: bash` (which runs with `-o pipefail`) or start with 
`set -o pipefail`?



##########
.github/workflows/maven_test.yml:
##########
@@ -53,14 +53,10 @@ on:
         default: '{}'
 jobs:
   # Precompile Spark with Maven once and publish target/ + ~/.m2/.../spark as
-  # an artifact for the matrix entries below to consume. Optional: any failure
-  # here degrades the matrix to its original local `clean install` path.
+  # an artifact for the matrix entries below to consume.

Review Comment:
   **[4] The packaging pipelines have the same `pipefail` gap, and their 
artifact is now required.**
   
   "Package compile output" (L98, L100, and `python_hosted_runner_test.yml` 
L94) also runs under the default `bash -e`. If `tar` cannot read a file under 
some `target/`, it exits non-zero but still finishes the archive without it; 
`zstd` exits 0, so the step and its `ls -lh` check pass and the partial 
artifact is uploaded. With no fallback, every shard then has to use it, so the 
failure shows up later, in every shard and in a less clear form, instead of 
once here. Could these steps also use `shell: bash` or `set -o pipefail`?



##########
.github/workflows/maven_test.yml:
##########
@@ -118,7 +114,6 @@ jobs:
   build:
     name: "Build modules: ${{ matrix.modules }} ${{ matrix.comment }}"
     needs: precompile-maven

Review Comment:
   **[6] Nit: the `head_sha || inputs.branch` fallback is dead now.**
   
   With `if: (!cancelled())` gone, this job runs only after `precompile-maven` 
succeeds, and `checkout-and-sync` always sets `head_sha` when it succeeds. So 
`|| inputs.branch` at L195 and its comment at L194 ("Fall back to the branch 
when the precompile job failed before resolving the SHA.") can no longer apply; 
the same holds at `python_hosted_runner_test.yml` L156-157. Keeping the 
fallback could also hide a future bug where `head_sha` comes back empty: the 
shard would quietly test the branch tip instead of the commit in the artifact. 
Could L195 use `needs.precompile-maven.outputs.head_sha` alone, as 
`build_and_test.yml` does with `needs.precondition.outputs.head_sha`?



##########
.github/workflows/maven_test.yml:
##########
@@ -220,15 +215,11 @@ jobs:
           python3.12 -m pip list
       - name: Download precompiled artifact
         id: download-precompiled

Review Comment:
   **[7] Nit: these step ids have no users left.**
   
   `download-precompiled` here and `extract-precompiled` at L222 were 
referenced only by the `if:` conditions and the `outcome` check that this PR 
removes. The same holds at `python_hosted_runner_test.yml` L177 and L182. 
SPARK-58880 dropped the same ids from `build_and_test.yml`. Could they go here 
too?



##########
.github/workflows/python_hosted_runner_test.yml:
##########
@@ -180,26 +175,20 @@ jobs:
         run: python${{matrix.python}} -m pip list
       - name: Download precompiled artifact
         id: download-precompiled
-        if: needs.precompile.result == 'success'
-        continue-on-error: true
         uses: actions/download-artifact@v8
         with:
           name: spark-compile-${{ inputs.os }}-${{ inputs.branch }}-${{ 
github.run_id }}
       - name: Extract precompiled artifact

Review Comment:
   **[9] Nit: could the restore steps become one composite action?**
   
   The download and extract steps, now required, are written out by hand in 
seven jobs of `build_and_test.yml`, in `maven_test.yml`, and here. This PR is 
already the second pass to bring these copies in line after SPARK-58880, and a 
fix like the `pipefail` one in item 3 would have to be repeated in every copy. 
Could a `.github/actions/restore-precompiled` action next to 
`checkout-and-sync` and `setup-build-env` hold them, here or in a follow-up?



##########
.github/workflows/python_hosted_runner_test.yml:
##########
@@ -180,26 +175,20 @@ jobs:
         run: python${{matrix.python}} -m pip list
       - name: Download precompiled artifact
         id: download-precompiled
-        if: needs.precompile.result == 'success'
-        continue-on-error: true
         uses: actions/download-artifact@v8
         with:
           name: spark-compile-${{ inputs.os }}-${{ inputs.branch }}-${{ 
github.run_id }}
       - name: Extract precompiled artifact
         id: extract-precompiled
-        if: steps.download-precompiled.outcome == 'success'
-        continue-on-error: true
         run: |
           zstd -dc compile-artifact.tar.zst | tar -xf -
           rm compile-artifact.tar.zst
       # Run the tests.
       - name: Run tests
         env: ${{ fromJSON(inputs.envs) }}
         run: |
-          if [ "${{ steps.extract-precompiled.outcome }}" = "success" ]; then
-            export SKIP_SCALA_BUILD=true
-            echo "Reusing precompiled artifact, skipping local SBT build."
-          fi
+          export SKIP_SCALA_BUILD=true

Review Comment:
   **[8] Minor: the shards still restore the Coursier cache, which only the 
removed SBT build needed.**
   
   With `SKIP_SCALA_BUILD` always set here, `SKIP_MIMA` set at L145, and 
`--modules` passed to `dev/run-tests` (which skips the style checks), 
`dev/run-tests` no longer calls `build/sbt` for these Python modules. The 
"Setup build environment" step of this job (L158-161) still uses the default 
`coursier: 'restore'`, so each shard restores `~/.cache/coursier` for nothing. 
Could it pass `coursier: none`, as the Maven build job already does?



##########
.github/workflows/maven_test.yml:
##########
@@ -256,26 +247,18 @@ jobs:
           export ENABLE_KINESIS_TESTS=0
           # Replace with the real module name, for example, 
connector#kafka-0-10 -> connector/kafka-0-10
           export TEST_MODULES=`echo "$MODULES_TO_TEST" | sed -e "s%#%/%g"`
-          if [ "${{ steps.extract-precompiled.outcome }}" = "success" ]; then
-            echo "Reusing precompiled artifact, skipping local Maven clean 
install."
-            # SPARK-51628 regression coverage is naturally preserved on the 
reuse
-            # path: the precompile artifact excludes assembly/, so non-connect
-            # tests already run with the assembly module's jars dir missing.
-            # Connect tests strongly depend on a built assembly module; rebuild
-            # it here.
-            if [ "$MODULES_TO_TEST" = "connect" ]; then
-              echo "Building assembly module for connect tests."
-              ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} -pl assembly install
-            fi
-          else
-            ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} clean install
-            # SPARK-51628: wipe the assembly module so tests exercise the
-            # SPARK-51600 prepend fallback path. Connect tests strongly depend
-            # on a built assembly module, so they are excluded.
-            if [ "$MODULES_TO_TEST" != "connect" ]; then
-              echo "Clean up the assembly module before maven testing"
-              ./build/mvn $MAVEN_CLI_OPTS clean -pl assembly
-            fi
+          echo "Reusing precompiled artifact, skipping local Maven clean 
install."

Review Comment:
   **[11] Minor: this predates the PR and is outside its diff, but the 
`repl,sql#hive-thriftserver` shard still compiles locally.**
   
   At L273-275, that shard runs `clean install` "to avoid a compilation loop", 
a workaround from SPARK-44567 (2023) that predates the precompiled artifact. 
`clean` deletes the `target/` directories just extracted for `repl` and 
`sql/hive-thriftserver`, so Maven recompiles both modules in every run, and 
this message is not quite true for that shard. Could a follow-up check whether 
that shard can use `test` like the others, now that `org/apache/spark` comes 
from `compile-m2-spark`?



##########
.github/workflows/maven_test.yml:
##########
@@ -256,26 +247,18 @@ jobs:
           export ENABLE_KINESIS_TESTS=0
           # Replace with the real module name, for example, 
connector#kafka-0-10 -> connector/kafka-0-10
           export TEST_MODULES=`echo "$MODULES_TO_TEST" | sed -e "s%#%/%g"`
-          if [ "${{ steps.extract-precompiled.outcome }}" = "success" ]; then
-            echo "Reusing precompiled artifact, skipping local Maven clean 
install."
-            # SPARK-51628 regression coverage is naturally preserved on the 
reuse
-            # path: the precompile artifact excludes assembly/, so non-connect
-            # tests already run with the assembly module's jars dir missing.
-            # Connect tests strongly depend on a built assembly module; rebuild
-            # it here.
-            if [ "$MODULES_TO_TEST" = "connect" ]; then
-              echo "Building assembly module for connect tests."
-              ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} -pl assembly install
-            fi
-          else
-            ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} clean install
-            # SPARK-51628: wipe the assembly module so tests exercise the
-            # SPARK-51600 prepend fallback path. Connect tests strongly depend
-            # on a built assembly module, so they are excluded.
-            if [ "$MODULES_TO_TEST" != "connect" ]; then
-              echo "Clean up the assembly module before maven testing"
-              ./build/mvn $MAVEN_CLI_OPTS clean -pl assembly
-            fi
+          echo "Reusing precompiled artifact, skipping local Maven clean 
install."
+          # SPARK-51628 regression coverage is naturally preserved on the reuse
+          # path: the precompile artifact excludes assembly/, so non-connect
+          # tests already run with the assembly module's jars dir missing.
+          # Connect tests strongly depend on a built assembly module; rebuild
+          # it here.

Review Comment:
   **[5] Minor: the assembly comments no longer match the code.**
   
   This PR removes the last `mvn clean -pl assembly`, so nothing wipes 
`assembly/` any more. The comment on "Package compile output" (L93-95) still 
says that "11 of 12 matrix entries wipe it right after extraction", which reads 
as if `assembly/` were left out of the artifact only to save space. After this 
PR, the SPARK-51628 coverage depends on that exclusion alone, so someone who 
adds `assembly/` to the artifact would drop it without noticing. This comment 
also still says "on the reuse path", which is now the only path. Could L93-95 
say that the exclusion is what keeps the SPARK-51628 coverage, and could this 
comment drop "on the reuse path"?



##########
.github/workflows/maven_test.yml:
##########
@@ -53,14 +53,10 @@ on:
         default: '{}'
 jobs:
   # Precompile Spark with Maven once and publish target/ + ~/.m2/.../spark as

Review Comment:
   **[12] Minor: this predates the PR, but the Maven cache saved by this job 
includes the Spark jars.**
   
   This job sets `cache-maven-local: 'true'` (L81), and `actions/cache` saves 
`~/.m2/repository` at the end of the job, after `clean install` has put this 
run's `org/apache/spark` SNAPSHOT jars there. When the key 
`maven-<os>-java<ver>-<hash(**/pom.xml)>` misses, for example after a `pom.xml` 
change, this job saves the entry with those jars. The shards then get an exact 
hit and do not save, so their "Clean up local Maven repository" step (L287-289) 
cannot keep the jars out of the cache. Could this job remove 
`~/.m2/repository/org/apache/spark` after "Upload compile artifact", in a 
follow-up if you prefer?



##########
.github/workflows/maven_test.yml:
##########
@@ -256,26 +247,18 @@ jobs:
           export ENABLE_KINESIS_TESTS=0
           # Replace with the real module name, for example, 
connector#kafka-0-10 -> connector/kafka-0-10
           export TEST_MODULES=`echo "$MODULES_TO_TEST" | sed -e "s%#%/%g"`
-          if [ "${{ steps.extract-precompiled.outcome }}" = "success" ]; then
-            echo "Reusing precompiled artifact, skipping local Maven clean 
install."
-            # SPARK-51628 regression coverage is naturally preserved on the 
reuse
-            # path: the precompile artifact excludes assembly/, so non-connect
-            # tests already run with the assembly module's jars dir missing.
-            # Connect tests strongly depend on a built assembly module; rebuild
-            # it here.
-            if [ "$MODULES_TO_TEST" = "connect" ]; then
-              echo "Building assembly module for connect tests."
-              ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} -pl assembly install
-            fi
-          else
-            ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} clean install
-            # SPARK-51628: wipe the assembly module so tests exercise the
-            # SPARK-51600 prepend fallback path. Connect tests strongly depend
-            # on a built assembly module, so they are excluded.
-            if [ "$MODULES_TO_TEST" != "connect" ]; then
-              echo "Clean up the assembly module before maven testing"
-              ./build/mvn $MAVEN_CLI_OPTS clean -pl assembly
-            fi
+          echo "Reusing precompiled artifact, skipping local Maven clean 
install."
+          # SPARK-51628 regression coverage is naturally preserved on the reuse
+          # path: the precompile artifact excludes assembly/, so non-connect
+          # tests already run with the assembly module's jars dir missing.
+          # Connect tests strongly depend on a built assembly module; rebuild
+          # it here.
+          if [ "$MODULES_TO_TEST" = "connect" ]; then
+            echo "Building assembly module for connect tests."
+            ./build/mvn $MAVEN_CLI_OPTS -DskipTests -Pyarn -Pkubernetes 
-Pvolcano -Phive \
+              -Phive-thriftserver -Phadoop-cloud -Pjvm-profiler 
-Pspark-ganglia-lgpl \
+              -Pkinesis-asl -Pcredential-aws 
-Djava.version=${JAVA_VERSION/-ea} -pl assembly \
+              install

Review Comment:
   **[10] Nit: this command was re-wrapped while being moved.**
   
   It was one line before this PR, like every other `./build/mvn` call in this 
step (L265-285) and in the precompile job (L90). Could it stay on one line, so 
the diff is smaller and its profile list is easy to compare with the 
neighboring calls?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to