|
| 1 | +name: Recover PR 1767 ingest |
| 2 | +run-name: "Recover PR #1767 ingest from run 27595478969" |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + confirm: |
| 8 | + description: "Enter recover-pr-1767 to run the artifact-only recovery" |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + |
| 12 | +permissions: |
| 13 | + actions: read |
| 14 | + contents: read |
| 15 | + |
| 16 | +jobs: |
| 17 | + recover-ingest: |
| 18 | + if: ${{ inputs.confirm == 'recover-pr-1767' }} |
| 19 | + runs-on: ubuntu-latest |
| 20 | + env: |
| 21 | + SOURCE_REPO: SemiAnalysisAI/InferenceX |
| 22 | + SOURCE_RUN_ID: "27595478969" |
| 23 | + SOURCE_PR_NUMBER: "1767" |
| 24 | + SOURCE_HEAD_SHA: 728eb321dd4b1decd81b2d460cb39aa369a0c9c8 |
| 25 | + ORIGINAL_BASE_SHA: d99c824b1c4f0b1b007631191657e458ef2a332c |
| 26 | + ORIGINAL_MERGE_SHA: 7b9843d3a6e1fe7a2d92d327e25aae57ed3506c5 |
| 27 | + steps: |
| 28 | + - name: Checkout recovery code |
| 29 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + - name: Validate reusable source run |
| 34 | + env: |
| 35 | + GH_TOKEN: ${{ secrets.REPO_PAT || github.token }} |
| 36 | + run: | |
| 37 | + run_json=$(gh api "repos/${SOURCE_REPO}/actions/runs/${SOURCE_RUN_ID}") |
| 38 | + jq -e \ |
| 39 | + --arg expected_head "$SOURCE_HEAD_SHA" \ |
| 40 | + '.event == "pull_request" and |
| 41 | + .status == "completed" and |
| 42 | + .conclusion == "success" and |
| 43 | + .path == ".github/workflows/run-sweep.yml" and |
| 44 | + .head_sha == $expected_head' \ |
| 45 | + <<<"$run_json" >/dev/null |
| 46 | +
|
| 47 | + gh api "repos/${SOURCE_REPO}/pulls/${SOURCE_PR_NUMBER}/commits" \ |
| 48 | + --paginate --jq '.[].sha' \ |
| 49 | + | grep -Fxq "$SOURCE_HEAD_SHA" |
| 50 | +
|
| 51 | + artifacts_json=$(gh api \ |
| 52 | + "repos/${SOURCE_REPO}/actions/runs/${SOURCE_RUN_ID}/artifacts?per_page=100") |
| 53 | + for required in results_bmk eval_results_all run-stats; do |
| 54 | + jq -e --arg name "$required" \ |
| 55 | + '.artifacts[] | select(.name == $name and (.expired | not))' \ |
| 56 | + <<<"$artifacts_json" >/dev/null |
| 57 | + done |
| 58 | +
|
| 59 | + - name: Reconstruct corrected merge configuration |
| 60 | + run: | |
| 61 | + git checkout --detach "$ORIGINAL_MERGE_SHA" |
| 62 | + test "$(git rev-parse "${ORIGINAL_MERGE_SHA}^")" = "$ORIGINAL_BASE_SHA" |
| 63 | +
|
| 64 | + perl -0pi -e \ |
| 65 | + 's/^ - config-keys:\n( - dsr1-fp8-gb300-dynamo-trt\n)/- config-keys:\n$1/m' \ |
| 66 | + perf-changelog.yaml |
| 67 | + grep -A1 '^- config-keys:$' perf-changelog.yaml \ |
| 68 | + | grep -q 'dsr1-fp8-gb300-dynamo-trt' |
| 69 | + if grep -A1 '^ - config-keys:$' perf-changelog.yaml \ |
| 70 | + | grep -q 'dsr1-fp8-gb300-dynamo-trt'; then |
| 71 | + echo "PR #1767 changelog indentation is still malformed" >&2 |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | +
|
| 75 | + git add perf-changelog.yaml |
| 76 | + fixed_tree=$(git write-tree) |
| 77 | + fixed_sha=$(printf '%s\n' 'Synthetic corrected PR #1767 merge tree' \ |
| 78 | + | git -c user.name='InferenceX Recovery' \ |
| 79 | + -c user.email='actions@users.noreply.github.com' \ |
| 80 | + commit-tree "$fixed_tree" -p "$ORIGINAL_BASE_SHA") |
| 81 | +
|
| 82 | + pip install pydantic |
| 83 | + python3 utils/process_changelog.py \ |
| 84 | + --changelog-file perf-changelog.yaml \ |
| 85 | + --base-ref "$ORIGINAL_BASE_SHA" \ |
| 86 | + --head-ref "$fixed_sha" \ |
| 87 | + > "$RUNNER_TEMP/full-config.json" |
| 88 | + jq empty "$RUNNER_TEMP/full-config.json" |
| 89 | +
|
| 90 | + mkdir -p "$RUNNER_TEMP/changelog-metadata" |
| 91 | + jq \ |
| 92 | + --arg base "$ORIGINAL_BASE_SHA" \ |
| 93 | + --arg head "$ORIGINAL_MERGE_SHA" \ |
| 94 | + '.changelog_metadata | .base_ref = $base | .head_ref = $head' \ |
| 95 | + "$RUNNER_TEMP/full-config.json" \ |
| 96 | + > "$RUNNER_TEMP/changelog-metadata/changelog_metadata.json" |
| 97 | +
|
| 98 | + - name: Download reusable benchmark artifacts |
| 99 | + env: |
| 100 | + GH_TOKEN: ${{ secrets.REPO_PAT || github.token }} |
| 101 | + run: | |
| 102 | + artifacts_dir="$RUNNER_TEMP/source-artifacts" |
| 103 | + gh run download "$SOURCE_RUN_ID" \ |
| 104 | + --repo "$SOURCE_REPO" \ |
| 105 | + -D "$artifacts_dir" |
| 106 | +
|
| 107 | + rm -rf "$artifacts_dir/changelog-metadata" |
| 108 | + for artifact_dir in "$artifacts_dir"/*; do |
| 109 | + [ -e "$artifact_dir" ] || continue |
| 110 | + name=$(basename "$artifact_dir") |
| 111 | + case "$name" in |
| 112 | + results_bmk|eval_results_all|run-stats|bmk_*|eval_*|server_logs_*|multinode_server_logs_*|agentic_aggregated) |
| 113 | + ;; |
| 114 | + *) |
| 115 | + rm -rf "$artifact_dir" |
| 116 | + ;; |
| 117 | + esac |
| 118 | + done |
| 119 | +
|
| 120 | + mkdir -p "$artifacts_dir/reused-ingest-metadata" |
| 121 | + jq -n \ |
| 122 | + --arg source_run_id "$SOURCE_RUN_ID" \ |
| 123 | + --arg source_run_attempt "1" \ |
| 124 | + --arg source_run_url "https://github.com/${SOURCE_REPO}/actions/runs/${SOURCE_RUN_ID}" \ |
| 125 | + --arg source_pr_number "$SOURCE_PR_NUMBER" \ |
| 126 | + --arg source_head_sha "$SOURCE_HEAD_SHA" \ |
| 127 | + --arg ingest_run_id "$GITHUB_RUN_ID" \ |
| 128 | + --arg ingest_run_attempt "$GITHUB_RUN_ATTEMPT" \ |
| 129 | + --arg ingest_run_url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ |
| 130 | + '{ |
| 131 | + source_run_id: $source_run_id, |
| 132 | + source_run_attempt: $source_run_attempt, |
| 133 | + source_run_url: $source_run_url, |
| 134 | + source_pr_number: $source_pr_number, |
| 135 | + source_head_sha: $source_head_sha, |
| 136 | + ingest_run_id: $ingest_run_id, |
| 137 | + ingest_run_attempt: $ingest_run_attempt, |
| 138 | + ingest_run_url: $ingest_run_url |
| 139 | + }' \ |
| 140 | + > "$artifacts_dir/reused-ingest-metadata/reuse_source_run.json" |
| 141 | +
|
| 142 | + - name: Validate reusable artifacts |
| 143 | + run: | |
| 144 | + python3 utils/validate_reusable_sweep_artifacts.py \ |
| 145 | + --config-json "$RUNNER_TEMP/full-config.json" \ |
| 146 | + --artifacts-dir "$RUNNER_TEMP/source-artifacts" |
| 147 | +
|
| 148 | + - name: Upload reusable ingest artifacts |
| 149 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 150 | + with: |
| 151 | + name: reused-ingest-artifacts |
| 152 | + path: ${{ runner.temp }}/source-artifacts/* |
| 153 | + |
| 154 | + - name: Upload corrected changelog metadata |
| 155 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 156 | + with: |
| 157 | + name: changelog-metadata |
| 158 | + path: ${{ runner.temp }}/changelog-metadata/changelog_metadata.json |
| 159 | + |
| 160 | + - name: Trigger database ingest |
| 161 | + run: | |
| 162 | + curl -sSf -X POST \ |
| 163 | + -H "Authorization: Bearer ${{ secrets.INFX_FRONTEND_PAT }}" \ |
| 164 | + -H "Accept: application/vnd.github+v3+json" \ |
| 165 | + https://api.github.com/repos/SemiAnalysisAI/InferenceX-app/dispatches \ |
| 166 | + -d '{ |
| 167 | + "event_type": "ingest-results", |
| 168 | + "client_payload": { |
| 169 | + "run-id": "${{ github.run_id }}", |
| 170 | + "run-attempt": "${{ github.run_attempt }}" |
| 171 | + } |
| 172 | + }' |
0 commit comments