[Backfill] single_date - 2024-02-01 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backfill Pipeline | |
| permissions: | |
| issues: write | |
| contents: read | |
| on: | |
| issues: | |
| types: [opened, labeled] | |
| workflow_dispatch: | |
| inputs: | |
| mode: | |
| description: 'Backfill mode' | |
| required: true | |
| type: choice | |
| options: | |
| - single_date | |
| - date_range | |
| - identifiers | |
| default: single_date | |
| date: | |
| description: 'Single date (YYYY-MM-DD)' | |
| required: false | |
| start_date: | |
| description: 'Range start (YYYY-MM-DD)' | |
| required: false | |
| end_date: | |
| description: 'Range end (YYYY-MM-DD)' | |
| required: false | |
| identifiers: | |
| description: 'Comma-separated arXiv IDs, DOIs, or URLs' | |
| required: false | |
| dry_run: | |
| description: 'Dry run (no actual ingestion)' | |
| type: boolean | |
| default: false | |
| issue_number: | |
| description: 'GitHub Issue number (reads payload from issue body)' | |
| required: false | |
| concurrency: | |
| group: backfill | |
| cancel-in-progress: false | |
| env: | |
| PYTHON_VERSION: '3.11' | |
| jobs: | |
| backfill: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| if: >- | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'issues' && contains(github.event.issue.labels.*.name, 'backfill')) | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: Parse inputs | |
| id: parse | |
| env: | |
| INPUT_MODE: ${{ inputs.mode }} | |
| INPUT_DATE: ${{ inputs.date }} | |
| INPUT_START_DATE: ${{ inputs.start_date }} | |
| INPUT_END_DATE: ${{ inputs.end_date }} | |
| INPUT_IDENTIFIERS: ${{ inputs.identifiers }} | |
| INPUT_DRY_RUN: ${{ inputs.dry_run }} | |
| INPUT_ISSUE_NUMBER: ${{ inputs.issue_number || github.event.issue.number }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python backfill/parse_inputs.py | |
| - name: Run backfill | |
| env: | |
| CONTEXTUAL_API_KEY: ${{ secrets.CONTEXTUAL_API_KEY }} | |
| CONTEXTUAL_DATASTORE_ID: ${{ secrets.CONTEXTUAL_DATASTORE_ID }} | |
| CONTEXTUAL_BASE_URL: ${{ secrets.CONTEXTUAL_BASE_URL }} | |
| LLM_API_KEYS: ${{ secrets.LLM_API_KEYS }} | |
| LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} | |
| ARXIV_THROTTLE_SECONDS: '3' | |
| run: | | |
| ${{ steps.parse.outputs.command }} | |
| - name: Upload artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: backfill-run-${{ github.run_number }} | |
| path: artifacts/ | |
| retention-days: 30 | |
| if-no-files-found: ignore | |
| - name: Comment on issue and close | |
| if: ${{ steps.parse.outputs.issue_number != '' && always() }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| ISSUE="${{ steps.parse.outputs.issue_number }}" | |
| STATUS="${{ job.status }}" | |
| SUMMARY="Backfill workflow **${STATUS}**." | |
| if [ -f artifacts/run_summary.md ]; then | |
| SUMMARY="${SUMMARY}\n\n$(cat artifacts/run_summary.md)" | |
| fi | |
| gh issue comment "${ISSUE}" --body "$(echo -e "${SUMMARY}")" | |
| gh issue close "${ISSUE}" --reason completed | |
| gh issue edit "${ISSUE}" --add-label "processed" | |
| - name: Summary | |
| run: | | |
| echo "## Backfill Pipeline Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f artifacts/run_summary.md ]; then | |
| cat artifacts/run_summary.md >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "No summary generated" >> $GITHUB_STEP_SUMMARY | |
| fi |