Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/actions/run_event_validation/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ inputs:
component:
description: "Component name to use"
required: true
run-status-file:
description: "status.json of the producer run ([{scenario, state, job_id}]); scenarios whose job isn't DONE fail"
default: ""
required: false


outputs:
Expand Down Expand Up @@ -70,4 +74,6 @@ runs:
--component="${{ inputs.component }}" \
--producer_dir=${{ inputs.producer-dir }} \
--openlineage_version=${{ inputs.release_tags }} \
--component_version=${{ inputs.component_release }}
--component_version=${{ inputs.component_release }} \
${{ inputs.ol_release && format('--openlineage_release={0}', inputs.ol_release) || '' }} \
${{ inputs.run-status-file && format('--run_status={0}', inputs.run-status-file) || '' }}
1 change: 1 addition & 0 deletions .github/workflows/check_scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
name: scenarios-report
path: reports/scenarios-report.json
retention-days: 1
if-no-files-found: error

- name: fail for failures in report
id: fail-for-failures
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/consumer_dataplex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ jobs:
name: dataplex-report
path: dataplex-report.json
retention-days: 1
if-no-files-found: error

19 changes: 16 additions & 3 deletions .github/workflows/producer_dbt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,25 @@ jobs:
set -e
IFS=';' read -ra scenarios <<< "${{ steps.init.outputs.scenarios }}"

# one entry per scenario, [{scenario, state, job_id}]; a failed run.sh fails its scenario in validation
status_file="${{ steps.set-producer-output.outputs.event_dir }}/status.json"
mkdir -p "${{ steps.set-producer-output.outputs.event_dir }}"
echo '[]' > "$status_file"

for scenario in "${scenarios[@]}"
do
echo "Running dbt scenario: $scenario"

mkdir -p "${{ steps.set-producer-output.outputs.event_dir }}/$scenario"
bash producer/dbt/scenarios/$scenario/test/run.sh "${{ steps.set-producer-output.outputs.event_dir }}/$scenario"

echo "Finished running scenario: $scenario"
if bash producer/dbt/scenarios/$scenario/test/run.sh "${{ steps.set-producer-output.outputs.event_dir }}/$scenario"; then
state=DONE
echo "Finished running scenario: $scenario"
else
state=FAILED
echo "::warning::dbt scenario $scenario failed"
fi
jq --arg scenario "$scenario" --arg state "$state" '. + [{scenario: $scenario, state: $state, job_id: ""}]' \
"$status_file" > "$status_file.tmp" && mv "$status_file.tmp" "$status_file"
done

echo "Finished running all scenarios"
Expand All @@ -119,10 +130,12 @@ jobs:
component_release: ${{ inputs.dbt_release }}
event-directory: ${{ steps.set-producer-output.outputs.event_dir }}
target-path: 'dbt-${{inputs.dbt_release}}-${{inputs.ol_release}}-report.json'
run-status-file: ${{ steps.set-producer-output.outputs.event_dir }}/status.json

- uses: actions/upload-artifact@v4
if: ${{ steps.init.outputs.scenarios }}
with:
name: dbt-${{inputs.dbt_release}}-${{inputs.ol_release}}-report
path: dbt-${{inputs.dbt_release}}-${{inputs.ol_release}}-report.json
retention-days: 1
if-no-files-found: error
40 changes: 23 additions & 17 deletions .github/workflows/producer_hive_dataproc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
skip-s3: 'true'
skip-gcp-lineage: 'true'
skip-sql: 'true'
skip-gcs: 'true' # see GCS_TRANSPORT_JAR below

- name: Upload openlineage hive integration to GCS
id: upload-hive-integration
Expand All @@ -76,15 +77,6 @@ jobs:
gcs-path: "gs://open-lineage-e2e/jars"
credentials: ${{ steps.gcp-auth.outputs.credentials_file_path }}

- name: Upload openlineage GCS transport to GCS
id: upload-gcs-transport
if: ${{ steps.init.outputs.scenarios }}
uses: ./.github/actions/upload_artifacts
with:
local-file-path: ${{ steps.get-ol-artifacts.outputs.gcs }}
gcs-path: "gs://open-lineage-e2e/jars"
credentials: ${{ steps.gcp-auth.outputs.credentials_file_path }}

- name: Upload initialization actions to GCS
id: upload-initialization-actions
if: ${{ steps.init.outputs.scenarios }}
Expand All @@ -106,7 +98,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f producer/hive_dataproc/runner/requirements.txt ]; then pip install -r producer/spark_dataproc/runner/requirements.txt; fi
if [ -f producer/hive_dataproc/runner/requirements.txt ]; then pip install -r producer/hive_dataproc/runner/requirements.txt; fi


- name: Start producer
Expand All @@ -119,7 +111,10 @@ jobs:
region: us-west1
create-command: |
metadata=''
metadata+='GCS_TRANSPORT_JAR=${{ steps.upload-gcs-transport.outputs.uploaded-file }}'
# Temporary: released transports-gcs 1.40.0-1.55.0 break Hive on Dataproc (half-relocated Woodstox stops
# HiveServer2, the bundled Conscrypt native library aborts the Tez AM). This snapshot has both fixed; go back
# to uploading the matching transport (get-ol-artifacts' gcs output) once a release has the fix (1.56.0?).
metadata+='GCS_TRANSPORT_JAR=gs://open-lineage-e2e/jars/transports-gcs-1.56.0-SNAPSHOT-conscrypt-fix.jar'
metadata+=',OPENLINEAGE_HIVE_URL=${{ steps.upload-hive-integration.outputs.uploaded-file }}'

properties=''
Expand Down Expand Up @@ -158,6 +153,12 @@ jobs:
properties+=',hive.openlineage.transport.type=gcs'
properties+=',hive.scenario.suffix=${{steps.init.outputs.component_cluster_suffix}}-${{steps.init.outputs.openlineage_cluster_suffix}}'

# one entry per scenario, [{scenario, state, job_id}] as written by the spark runner; a failed query fails
# its scenario in validation instead of stopping the other scenarios
status_file="${{ steps.set-producer-output.outputs.event_dir }}/status.json"
mkdir -p "${{ steps.set-producer-output.outputs.event_dir }}"
echo '[]' > "$status_file"

for scenario in "${scenarios[@]}"
do
echo "Getting script for scenario $scenario"
Expand All @@ -171,7 +172,7 @@ jobs:
properties+=",hive.openlineage.transport.bucketName=open-lineage-e2e"
properties+=",hive.openlineage.transport.fileNamePrefix=events/$scenario/$(date +%s%3N)/"

if ! python producer/hive_dataproc/runner/dataproc_workflow.py run-hive-query \
if python producer/hive_dataproc/runner/dataproc_workflow.py run-hive-query \
--project-id gcp-open-lineage-testing \
--region us-west1 \
--cluster-name "hive-dataproc-producer-test-${{steps.init.outputs.component_cluster_suffix}}-${{ steps.init.outputs.openlineage_cluster_suffix }}-${{ github.run_id }}" \
Expand All @@ -180,11 +181,14 @@ jobs:
--output-directory "${{ steps.set-producer-output.outputs.event_dir }}/$scenario" \
--properties "$properties"
then
echo "Error: hive job failed for scenario: $scenario"
exit 1
state=DONE
echo "Finished running hive job for scenario: $scenario"
else
state=FAILED
echo "::warning::hive job failed for scenario $scenario"
fi

echo "Finished running hive job for scenario: $scenario"
jq --arg scenario "$scenario" --arg state "$state" '. + [{scenario: $scenario, state: $state, job_id: ""}]' \
"$status_file" > "$status_file.tmp" && mv "$status_file.tmp" "$status_file"
done

echo "Finished running all scenarios"
Expand All @@ -198,7 +202,8 @@ jobs:
ol_release: ${{ inputs.ol_release }}
component_release: ${{ inputs.component_release }}
event-directory: ${{ steps.set-producer-output.outputs.event_dir }}
target-path: 'hive-dataproc-${{inputs.hive_release}}-${{inputs.ol_release}}-report.json'
target-path: 'hive-dataproc-${{inputs.component_release}}-${{inputs.ol_release}}-report.json'
run-status-file: ${{ steps.set-producer-output.outputs.event_dir }}/status.json

# the events PR checks re-validate when validation code changes (revalidate_stored_events.yml)
- name: Update baseline events
Expand All @@ -213,3 +218,4 @@ jobs:
name: hive-dataproc-${{inputs.component_release}}-${{inputs.ol_release}}-report
path: hive-dataproc-${{inputs.component_release}}-${{inputs.ol_release}}-report.json
retention-days: 1
if-no-files-found: error
98 changes: 52 additions & 46 deletions .github/workflows/producer_spark_dataproc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ jobs:
--credentials-file "${{ steps.gcp-auth.outputs.credentials_file_path }}" \
|| echo "::warning::Some scenarios failed for OpenLineage $ol_release"

# check-spark-jobs fails the workflow for every scenario not in DONE state, so a runner crash
# that left no status.json must still be recorded
# validation fails every scenario whose job isn't in DONE state; a runner crash that left no status.json
# is recorded as RUNNER_FAILED for every scenario, which validation treats as "the pair didn't run"
if [[ ! -f "/tmp/driver-logs/$ol_release/status.json" ]]; then
mkdir -p "/tmp/driver-logs/$ol_release"
jq -n --arg s "$scenarios" '$s | split(";") | map({scenario: ., state: "RUNNER_FAILED", job_id: ""})' \
Expand All @@ -225,8 +225,13 @@ jobs:
|| echo "::warning::No driver logs for OpenLineage $ol_release"
done 3< /tmp/ol_scenarios

# runs for every pair whose Spark jobs ran, even when the cluster of another Spark release failed;
# a pair that didn't run produces no report, so the release check retries it (pending_runs.json)
validate:
needs: run-spark-tests
needs:
- stage-openlineage-jars
- run-spark-tests
if: ${{ !cancelled() && needs.stage-openlineage-jars.result == 'success' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -243,27 +248,57 @@ jobs:
scenarios=$(./scripts/get_valid_test_scenarios.sh "producer/spark_dataproc/scenarios/" ${{ matrix.spark_release }} ${{ matrix.ol_release }} )
[[ "$scenarios" == "" ]] || echo "scenarios=$scenarios" >> $GITHUB_OUTPUT
echo "event_dir=/tmp/producer-$(date +%s%3N)" >> $GITHUB_OUTPUT
echo "gcs_suffix=${RUN_KEY}/${{ matrix.spark_release }}/${{ matrix.ol_release }}" >> $GITHUB_OUTPUT

- name: GCP authorization
if: ${{ steps.init.outputs.scenarios }}
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.gcpKey }}'

# status.json is written by the run step for every openlineage version it ran; without it, or when the runner
# itself crashed for every scenario, the pair didn't run: an infra problem, not a result, so the job fails
# without a report (the release check retries the pair, see pending_runs.json)
# "Re-run failed jobs" reruns this job but not a run job that passed, so the pair's files can be under an earlier
# attempt: the newest attempt that has a status.json is the pair's latest run
- name: Check that the pair ran
id: ran
if: ${{ steps.init.outputs.scenarios }}
run: |
pair="spark ${{ matrix.spark_release }}, openlineage ${{ matrix.ol_release }}"
status_file=/tmp/status-${{ matrix.spark_release }}-${{ matrix.ol_release }}.json
gcs_suffix=""
for (( attempt = ${{ github.run_attempt }}; attempt >= 1; attempt-- )); do
suffix="${{ github.run_id }}-$attempt/${{ matrix.spark_release }}/${{ matrix.ol_release }}"
if gcloud storage cp "gs://${GCS_BUCKET}/logs/$suffix/status.json" "$status_file" 2> /dev/null; then
gcs_suffix="$suffix"
break
fi
done
if [[ -z "$gcs_suffix" ]]; then
echo "::error title=Pair did not run::$pair has no status.json, its Spark jobs never ran"
exit 1
fi
[[ "$attempt" == "${{ github.run_attempt }}" ]] || echo "Using the results of run attempt $attempt"
echo "gcs_suffix=$gcs_suffix" >> "$GITHUB_OUTPUT"
if jq -e 'all(.[]; .state == "RUNNER_FAILED")' "$status_file" > /dev/null; then
echo "::error title=Pair did not run::$pair: the runner failed before running any scenario"
exit 1
fi
echo "status_file=$status_file" >> "$GITHUB_OUTPUT"

# every scenario gets a directory, so a scenario without events fails validation instead of being skipped
- name: Download events
if: ${{ steps.init.outputs.scenarios }}
if: ${{ steps.ran.outputs.status_file }}
run: |
IFS=';' read -ra scenarios <<< "${{ steps.init.outputs.scenarios }}"
for scenario in "${scenarios[@]}"; do
mkdir -p "${{ steps.init.outputs.event_dir }}/$scenario"
done
gcloud storage cp -r "gs://${GCS_BUCKET}/events/${{ steps.init.outputs.gcs_suffix }}/*" "${{ steps.init.outputs.event_dir }}/" \
gcloud storage cp -r "gs://${GCS_BUCKET}/events/${{ steps.ran.outputs.gcs_suffix }}/*" "${{ steps.init.outputs.event_dir }}/" \
|| echo "::warning::No events found"

- name: Validation
if: ${{ steps.init.outputs.scenarios }}
if: ${{ steps.ran.outputs.status_file }}
uses: ./.github/actions/run_event_validation
with:
component: 'spark_dataproc'
Expand All @@ -272,70 +307,41 @@ jobs:
component_release: ${{ matrix.spark_release }}
event-directory: ${{ steps.init.outputs.event_dir }}
target-path: 'spark-dataproc-${{matrix.spark_release}}-${{matrix.ol_release}}-report.json'
run-status-file: ${{ steps.ran.outputs.status_file }}

# the events PR checks re-validate when validation code changes (revalidate_stored_events.yml)
- name: Update baseline events
if: ${{ inputs.update-baseline && steps.init.outputs.scenarios }}
if: ${{ inputs.update-baseline && steps.ran.outputs.status_file }}
run: |
baseline="gs://${GCS_BUCKET}/baseline-events/spark_dataproc/${{ matrix.spark_release }}/${{ matrix.ol_release }}"
gcloud storage rsync -r --delete-unmatched-destination-objects "${{ steps.init.outputs.event_dir }}" "$baseline"
gcloud storage cp "gs://${GCS_BUCKET}/logs/${{ steps.init.outputs.gcs_suffix }}/status.json" "$baseline/status.json" \
|| echo "::warning::No status.json for spark ${{ matrix.spark_release }}, openlineage ${{ matrix.ol_release }}"
gcloud storage cp "${{ steps.ran.outputs.status_file }}" "$baseline/status.json"

- uses: actions/upload-artifact@v4
if: ${{ steps.init.outputs.scenarios }}
if: ${{ steps.ran.outputs.status_file }}
with:
name: spark-dataproc-${{matrix.spark_release}}-${{matrix.ol_release}}-report
path: spark-dataproc-${{matrix.spark_release}}-${{matrix.ol_release}}-report.json
retention-days: 1
if-no-files-found: error

# scenarios that failed validation or whose Dataproc job didn't finish in DONE state
# scenarios that failed validation, including those whose Dataproc job didn't finish in DONE state
- name: Get driver logs of failed scenarios
if: ${{ steps.init.outputs.scenarios }}
if: ${{ steps.ran.outputs.status_file }}
run: |
mkdir -p failure-logs
failed_scenarios=$( {
jq -r '.[].scenarios[] | select(.status == "FAILURE") | .name' 'spark-dataproc-${{matrix.spark_release}}-${{matrix.ol_release}}-report.json'
gcloud storage cat "gs://${GCS_BUCKET}/logs/${{ steps.init.outputs.gcs_suffix }}/status.json" 2> /dev/null \
| jq -r '.[] | select(.state != "DONE") | .scenario'
} | sort -u )
failed_scenarios=$(jq -r '.[].scenarios[] | select(.status == "FAILURE") | .name' 'spark-dataproc-${{matrix.spark_release}}-${{matrix.ol_release}}-report.json')
for scenario in $failed_scenarios; do
gcloud storage cp "gs://${GCS_BUCKET}/logs/${{ steps.init.outputs.gcs_suffix }}/$scenario.log" \
gcloud storage cp "gs://${GCS_BUCKET}/logs/${{ steps.ran.outputs.gcs_suffix }}/$scenario.log" \
"failure-logs/$scenario-${{matrix.spark_release}}-${{matrix.ol_release}}-driver.log" \
|| echo "::warning::No driver log for scenario $scenario"
done

- uses: actions/upload-artifact@v4
if: ${{ steps.init.outputs.scenarios }}
if: ${{ steps.ran.outputs.status_file }}
with:
name: spark-dataproc-${{matrix.spark_release}}-${{matrix.ol_release}}-failure-logs
path: failure-logs/
retention-days: 7
if-no-files-found: ignore

# validation only sees events, so a job that failed after emitting the expected events (e.g. a dependency
# conflict) would pass; this fails the workflow for every Dataproc job that didn't finish in DONE state
check-spark-jobs:
needs:
- run-spark-tests
- validate
if: ${{ !cancelled() && needs.run-spark-tests.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: GCP authorization
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.gcpKey }}'

- name: Fail if any Spark job didn't finish
run: |
failed=0
for status in $(gcloud storage ls "gs://${GCS_BUCKET}/logs/${RUN_KEY}/**/status.json" 2> /dev/null); do
pair=${status#gs://${GCS_BUCKET}/logs/${RUN_KEY}/}
pair=${pair%/status.json}
while IFS=$'\t' read -r scenario state job_id; do
echo "::error title=Spark job failed::$scenario (spark ${pair%%/*}, openlineage ${pair##*/}) ended in state $state, job '$job_id'. Driver log: artifact spark-dataproc-${pair/\//-}-failure-logs"
failed=1
done < <(gcloud storage cat "$status" | jq -r '.[] | select(.state != "DONE") | [.scenario, .state, .job_id] | @tsv')
done
exit $failed
4 changes: 3 additions & 1 deletion .github/workflows/revalidate_stored_events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ jobs:
for pair_dir in baseline/*/*/; do
pair=${pair_dir#baseline/}; pair=${pair%/}
cv=${pair%%/*}; ol=${pair##*/}
run_status=()
[[ -f "baseline/$pair.status.json" ]] && run_status=(--run_status="baseline/$pair.status.json")
echo "::group::${{ matrix.component }} $cv, openlineage $ol"
python scripts/validate_ol_events.py \
python scripts/validate_ol_events.py "${run_status[@]}" \
--event_base_dir="$pair_dir" \
--spec_base_dir=specs \
--target="pair-reports/$cv-$ol.json" \
Expand Down
4 changes: 3 additions & 1 deletion producer/hive_dataproc/runner/get_hive_openlineage_jars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ set -euxo pipefail
readonly VM_HADOOP_LIB_DIR=/usr/lib/hadoop/lib
readonly VM_DATAPROC_VM_HADOOP_LIB_DIR_DIR=/usr/local/share/google/dataproc/lib
readonly OPENLINEAGE_HIVE_URL=$(/usr/share/google/get_metadata_value attributes/OPENLINEAGE_HIVE_URL || echo "")
readonly GCS_TRANSPORT_JAR_URL=$(/usr/share/google/get_metadata_value attributes/GCS_TRANSPORT_JAR_URL || echo "")
# the workflow sets GCS_TRANSPORT_JAR; GCS_TRANSPORT_JAR_URL is the old name, still read as a fallback
readonly GCS_TRANSPORT_JAR_URL=$(/usr/share/google/get_metadata_value attributes/GCS_TRANSPORT_JAR \
|| /usr/share/google/get_metadata_value attributes/GCS_TRANSPORT_JAR_URL || echo "")

if [[ -d ${VM_DATAPROC_VM_HADOOP_LIB_DIR_DIR} ]]; then
vm_lib_dir=${VM_DATAPROC_VM_HADOOP_LIB_DIR_DIR}
Expand Down
Loading
Loading