spark-test commented on code in PR #59862: URL: https://github.com/apache/spark/pull/59862#discussion_r4506165222
########## .github/workflows/labeler.yml: ########## @@ -0,0 +1,94 @@ +# +# 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. +# + +# Scheduled to avoid pull_request_target; never check out or run PR code here. +# Labels in .github/labeler.yml are authoritative and must already exist. +# Manually added configured labels are removed on the next scan if they do not +# match the PR's changed files. +# +# To label all open PRs once, regardless of their last update: +# gh workflow run labeler.yml --repo apache/spark --ref master -f backfill=true + +name: Label pull requests + +on: + schedule: + - cron: "7-59/10 * * * *" + workflow_dispatch: + inputs: + backfill: + description: Label all open PRs regardless of their last update + type: boolean + default: false + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + queue: max + +jobs: + label: + name: Label pull requests + if: github.repository == 'apache/spark' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + pull-requests: write + steps: + - name: Checkout labeler configuration + uses: actions/checkout@v7 + with: + persist-credentials: false + sparse-checkout: .github + - name: List PRs + id: prs + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BACKFILL: ${{ inputs.backfill }} + run: | + if [[ "$BACKFILL" == "true" ]]; then + filters=(-f state=open) + echo "Listing all open PRs" + else + last_success=$(gh run list --workflow labeler.yml --branch master \ + --event schedule --status success --limit 1 --json startedAt \ + --jq '.[0].startedAt // empty') + if [ -n "$last_success" ]; then + # Keep a short overlap for PR updates during the previous run. + since=$(date -u -d "$last_success - 10 minutes" +%Y-%m-%dT%H:%M:%SZ) + else + since=$(date -u -d "12 hours ago" +%Y-%m-%dT%H:%M:%SZ) + fi + filters=(-f state=all -f since="$since") + echo "Listing PRs updated since $since" + fi + numbers=$(gh api --method GET --paginate "repos/$GITHUB_REPOSITORY/issues" \ + "${filters[@]}" -f sort=updated -f direction=asc \ Review Comment: **Nit (P3):** Pages are numbered over the live update order, so a listing longer than one page (more than 100 issues and PRs, as in a backfill, the 12-hour first run, or a catch-up after failed runs) can skip a PR. Suppose an item already returned on page 1 is updated before page 2 is fetched. It moves to the end of the ascending order, and every later result shifts one position earlier, so the result that was 101st is never listed. The run still succeeds. The next window starts 10 minutes before this run's start, so that PR usually keeps missing or stale labels until its next update, and a backfill never revisits it. In descending order an update moves the item toward pages already read, so the worst case is a duplicate or a freshly updated PR that the next window picks up: ```suggestion "${filters[@]}" -f sort=updated -f direction=desc \ ``` One case remains: a PR closed or merged during a backfill drops out of the open-only listing and can still make it skip one PR, but only if the close lands during the few page requests of a one-off run. **Verification:** - **Regression:** Simulate listings longer than one page in both modes. Between page fetches, update an item already returned (in incremental mode, also close one), update an item not yet returned, and open a new PR. Every PR selected when the listing started must be listed, or carry an update newer than the run's start so that the next scheduled window includes it. - **Inspection:** Confirm that both the incremental and the backfill listing request descending update order, and still filter by state and by the cut-off time exactly as before. ########## .github/workflows/labeler.yml: ########## @@ -0,0 +1,94 @@ +# +# 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. +# + +# Scheduled to avoid pull_request_target; never check out or run PR code here. +# Labels in .github/labeler.yml are authoritative and must already exist. +# Manually added configured labels are removed on the next scan if they do not +# match the PR's changed files. +# +# To label all open PRs once, regardless of their last update: +# gh workflow run labeler.yml --repo apache/spark --ref master -f backfill=true + +name: Label pull requests + +on: + schedule: + - cron: "7-59/10 * * * *" + workflow_dispatch: + inputs: + backfill: + description: Label all open PRs regardless of their last update + type: boolean + default: false + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + queue: max + +jobs: + label: + name: Label pull requests + if: github.repository == 'apache/spark' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + pull-requests: write + steps: + - name: Checkout labeler configuration + uses: actions/checkout@v7 + with: + persist-credentials: false + sparse-checkout: .github + - name: List PRs + id: prs + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BACKFILL: ${{ inputs.backfill }} + run: | + if [[ "$BACKFILL" == "true" ]]; then + filters=(-f state=open) + echo "Listing all open PRs" + else + last_success=$(gh run list --workflow labeler.yml --branch master \ + --event schedule --status success --limit 1 --json startedAt \ + --jq '.[0].startedAt // empty') + if [ -n "$last_success" ]; then + # Keep a short overlap for PR updates during the previous run. Review Comment: **Nit (P3):** The window starts from the last successful run's start time, so every update made during that run is already newer than that start and lands in the next window even without the overlap. The 10 minutes only help with updates stamped just before that start that the previous listing missed, through clock skew or listing lag. As written, the comment invites a later change that relies on the overlap for updates made during a run, such as moving the cut-off to the run's completion time. That would drop updates from runs longer than 10 minutes. Maybe: ```suggestion # The overlap covers clock skew or listing lag just before the last # successful run's start; updates during that run already fall after it. ``` **Verification:** - **Inspection:** Read the comment next to the cut-off calculation and confirm it attributes the overlap to clock skew or listing lag around the previous run's start, not to updates made during that run. The computed cut-off must be unchanged. ########## .github/labeler.yml: ########## @@ -0,0 +1,334 @@ +# +# 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. +# + +# Keep labels and globs sorted, with exclusions (!) after the globs they narrow. + +AVRO: + - changed-files: + - any-glob-to-any-file: [ + 'connector/avro/**/*', + 'python/**/avro/**/*', + ] + +BLOCK MANAGER: + - changed-files: + - all-globs-to-any-file: [ + 'core/src/**/storage/**/*', + '!**/ui/**/*', + ] + - any-glob-to-any-file: [ + 'common/utils/src/**/storage/**/*', + ] + +BUILD: + - changed-files: + - all-globs-to-any-file: [ + 'dev/**/*', + '!dev/create_jira_and_branch.py', + '!dev/create_spark_jira.py', + '!dev/merge_spark_pr.py', + '!dev/next_version_candidates.py', + '!dev/pr_merge_status.py', + '!dev/spark_jira_utils.py', + '!dev/spark_merge_footer.py', + ] + - any-glob-to-any-file: [ + '**/pom.xml', + '.mvn/**/*', + '.pre-commit-config.yaml', + '.sbtopts', + 'assembly/**/*', + 'bin/docker-image-tool.sh', + 'bin/find-spark-home*', + 'build/**/*', + 'project/**/*', + 'pyproject.toml', + 'scalastyle-config.xml', + ] + +CONNECT: + - changed-files: + - any-glob-to-any-file: [ + 'bin/spark-connect-shell', + 'connector/connect/**/*', + 'python/**/connect/**/*', + 'sbin/*-connect-server.sh', + 'sql/connect/**/*', + ] + +CORE: + - changed-files: + - all-globs-to-any-file: [ + 'common/config/**/*', + '!common/config/**/sql.textproto', + ] + - all-globs-to-any-file: [ + 'common/utils/**/*', + '!common/utils/src/main/resources/error/**', + ] + - all-globs-to-any-file: [ + 'core/**/*', + '!**/*UI.scala', + '!**/ui/**/*', + ] + - any-glob-to-any-file: [ + 'common/kvstore/**/*', + 'common/network-common/**/*', + 'common/network-shuffle/**/*', + 'common/tags/**/*', + 'common/utils-java/**/*', + 'python/pyspark/*.py', + 'python/pyspark/core/**/*', + 'python/pyspark/resource/**/*', + 'python/pyspark/tests/**/*.py', + ] + +DECLARATIVE PIPELINES: + - changed-files: + - any-glob-to-any-file: [ + 'bin/spark-pipelines', + 'docs/**/declarative-pipelines*', + 'python/docs/source/reference/pyspark.pipelines.rst', + 'python/pyspark/pipelines/**/*', + 'python/pyspark/sql/connect/proto/pipelines_pb2.*', + 'sql/**/pipelines/**/*', + 'sql/connect/common/src/main/protobuf/spark/connect/pipelines.proto', + ] + +DEPLOY: + - changed-files: + - any-glob-to-any-file: [ + 'bin/load-spark-env*', + 'bin/spark-class*', + 'conf/**/*', + 'sbin/**/*', + ] + +DOCS: + - changed-files: + - any-glob-to-any-file: [ + '**/CONTRIBUTING.md', + '**/README*', + 'docs/**/*', + 'python/docs/**/*', + ] + +DSTREAM: + - changed-files: + - any-glob-to-any-file: [ + 'connector/kafka-0-10/**/*', + 'connector/kafka-0-10-assembly/**/*', + 'connector/kafka-0-10-token-provider/**/*', + 'connector/kinesis-asl/**/*', + 'connector/kinesis-asl-assembly/**/*', + 'data/streaming/**/*', + 'python/pyspark/streaming/**/*', + 'streaming/**/*', + ] + +EXAMPLES: + - changed-files: + - any-glob-to-any-file: [ + 'bin/run-example*', + 'examples/**/*', + ] + +GRAPHX: + - changed-files: + - any-glob-to-any-file: [ + 'data/graphx/**/*', + 'graphx/**/*', + ] + +INFRA: + - changed-files: + - any-glob-to-any-file: [ + '.asf.yaml', + '.gitattributes', + '.github/**/*', + '.gitignore', + 'dev/create-release/**/*', + 'dev/create_jira_and_branch.py', + 'dev/create_spark_jira.py', + 'dev/merge_spark_pr.py', + 'dev/next_version_candidates.py', + 'dev/pr_merge_status.py', + 'dev/spark_jira_utils.py', + 'dev/spark_merge_footer.py', + 'tools/**/*', + ] + +KUBERNETES: + - changed-files: + - any-glob-to-any-file: [ + 'bin/docker-image-tool.sh', + 'resource-managers/kubernetes/**/*', + ] + +ML: + - changed-files: + - any-glob-to-any-file: [ + '**/*mllib_*.R', + '**/ml/**/*', + ] + +MLLIB: + - changed-files: + - any-glob-to-any-file: [ + '**/mllib/**/*', + 'mllib-local/**/*', + ] + +PANDAS API ON SPARK: + - changed-files: + - any-glob-to-any-file: [ + 'python/pyspark/pandas/**/*', + ] + +PROTOBUF: + - changed-files: + - any-glob-to-any-file: [ + 'connector/protobuf/**/*', + 'python/**/protobuf/**/*', + ] + +PYTHON: + - changed-files: + - any-glob-to-any-file: [ + '**/python/**/*', + 'bin/pyspark*', + 'pyproject.toml', + ] + +R: + - changed-files: + - any-glob-to-any-file: [ + '**/R/**/*', + '**/r/**/*', + 'bin/sparkR*', + ] + +SCHEDULER: + - changed-files: + - any-glob-to-any-file: [ + 'common/utils/src/**/scheduler/**/*', + 'core/src/**/scheduler/**/*', + ] + +SHUFFLE: + - changed-files: + - any-glob-to-any-file: [ + 'common/network-common/**/shuffle/**/*', + 'common/network-shuffle/**/*', + 'common/network-yarn/**/*', + 'core/src/**/shuffle/**/*', + 'resource-managers/**/shuffle/**/*', + ] + +SPARK SHELL: + - changed-files: + - any-glob-to-any-file: [ + 'bin/spark-shell*', + 'repl/**/*', + ] + +SPARK SUBMIT: + - changed-files: + - any-glob-to-any-file: [ + 'bin/spark-submit*', + 'core/src/**/SparkSubmit*', + 'launcher/**/*', + ] + +SQL: + - changed-files: + - all-globs-to-any-file: [ + '**/sql/**/*', + '!python/**/avro/**/*', + '!python/**/protobuf/**/*', + '!python/**/streaming/**/*', + ] + - any-glob-to-any-file: [ + '**/*catalog.R', + '**/*column.R', + '**/*functions.R', + '**/*group.R', + '**/*schema.R', + '**/*SQL*.R', + '**/*types.R', + '**/*WindowSpec.R', + '**/DataFrame.R', + 'bin/beeline*', + 'bin/spark-sql*', + 'common/config/**/sql.textproto', + 'common/sketch/**/*', + 'common/unsafe/**/*', + 'common/variant/**/*', + 'connector/docker-integration-tests/**/*', + 'sbin/*thriftserver*.sh', + ] + +STRUCTURED STREAMING: + - changed-files: + - any-glob-to-any-file: [ + '**/*streaming.R', + '**/sql/**/streaming/**/*', + 'connector/kafka-0-10-sql/**/*', + 'connector/kafka-0-10-token-provider/**/*', + ] + +UDF: + - changed-files: + - all-globs-to-any-file: [ + '**/*{UDAF,udaf,UDF,udf,UDTF,udtf,UserDefined*Aggregat*,UserDefined*Function*,UserDefinedScalar*}*', + '!**/*.sql.out', Review Comment: **Nit (P3):** L20 asks for sorted globs, but '-' sorts before '.', so `'!**/*-results.txt'` belongs before `'!**/*.sql.out'` here and in the second UDF list (L305-306). These two pairs are the only entries in the file that break its order, which compares paths one directory segment at a time and ignores case. Matching does not change, since every glob in an `all-globs-to-any-file` entry must hold regardless of order. Swapping each pair keeps the file consistent for the next person who re-sorts it. **Verification:** - **Inspection:** Confirm that each UDF entry lists the benchmark-results exclusion before the golden-file exclusion, and that both entries contain exactly the same globs as before. -- 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]
