feat(isolation): implement native PyTorch IPC output reconstruction a… #905
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: "⬆️ LIVE - Package Upgrade Test" | |
| on: | |
| push: | |
| branches: [ development ] | |
| pull_request: | |
| branches: [ development ] | |
| workflow_dispatch: | |
| jobs: | |
| test-package-upgrade: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install pip==24.0 | |
| pip install -e . redis | |
| - name: Configure omnipkg and Establish Authoritative ENV_ID | |
| id: setup_omnipkg | |
| run: | | |
| python - << 'EOF' | |
| import json | |
| import os | |
| from pathlib import Path | |
| from omnipkg.core import ConfigManager | |
| config_dir = Path.home() / '.config' / 'omnipkg' | |
| config_dir.mkdir(parents=True, exist_ok=True) | |
| config = { | |
| "interactive": False, | |
| "auto_confirm": True, | |
| "redis_url": "redis://localhost:6379" | |
| } | |
| with open(config_dir / 'config.json', 'w') as f: | |
| json.dump(config, f, indent=2) | |
| print("✅ Omnipkg configured for non-interactive use") | |
| main_env_id = ConfigManager().env_id | |
| print(f"Authoritative Environment ID for this job: {main_env_id}") | |
| with open(os.environ['GITHUB_ENV'], 'a') as f: | |
| f.write(f"OMNIPKG_ENV_ID_OVERRIDE={main_env_id}\n") | |
| EOF | |
| - name: Set Install Strategy to Latest-Active | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Setting install strategy to latest-active ---" | |
| omnipkg config set install_strategy latest-active | |
| - name: Install Older Version of Package | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Installing older version of requests (2.28.0) ---" | |
| mkdir -p /tmp/omnipkg-artifacts | |
| # This is the first command requiring a daemon. | |
| # It will trigger the auto-start and relaunch logic. | |
| # We use -y for non-interactive mode. | |
| omnipkg install requests==2.28.0 2>&1 | tee /tmp/omnipkg-artifacts/install_old_version.txt | |
| # Capture the exit code of omnipkg, not tee | |
| INSTALL_EXIT_CODE=${PIPESTATUS[0]} | |
| echo "## Install requests 2.28.0 Output" >> $GITHUB_STEP_SUMMARY | |
| # Verify installation and handle relaunch logs | |
| if [ $INSTALL_EXIT_CODE -eq 0 ] && grep -q "All package operations complete" /tmp/omnipkg-artifacts/install_old_version.txt; then | |
| echo "✅ requests 2.28.0 installed successfully" | |
| else | |
| echo "❌ Failed to install requests 2.28.0" | |
| exit 1 | |
| fi | |
| - name: Verify Initial Version | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Verifying initial requests version ---" | |
| omnipkg info requests 2>&1 | tee /tmp/omnipkg-artifacts/info_before_upgrade.txt | |
| echo "## requests Info Before Upgrade" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/omnipkg-artifacts/info_before_upgrade.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| # Check that 2.28.0 is active | |
| if grep -q "Active Version: 2.28.0" /tmp/omnipkg-artifacts/info_before_upgrade.txt; then | |
| echo "✅ Confirmed: requests 2.28.0 is active" | |
| else | |
| echo "❌ requests 2.28.0 is not active as expected" | |
| exit 1 | |
| fi | |
| - name: Run Package Upgrade | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Running omnipkg upgrade requests ---" | |
| # Use -y for non-interactive mode. | |
| # PIPESTATUS[0] ensures we get the exit code of the upgrade command. | |
| timeout 900 bash -c 'omnipkg upgrade requests -y' 2>&1 | tee /tmp/omnipkg-artifacts/upgrade_output.txt | |
| UPGRADE_EXIT_CODE=${PIPESTATUS[0]} | |
| echo "## Package Upgrade Output" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/omnipkg-artifacts/upgrade_output.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| # Verify upgrade completed | |
| if grep -q "All package operations complete" /tmp/omnipkg-artifacts/upgrade_output.txt; then | |
| echo "✅ Package upgrade completed successfully!" | |
| else | |
| echo "❌ Package upgrade did not complete successfully" | |
| exit 1 | |
| fi | |
| # Verify bubble was created for old version | |
| if grep -q "Creating isolated bubble for requests v2.28.0" /tmp/omnipkg-artifacts/upgrade_output.txt || \ | |
| grep -q "Bubbled requests v2.28.0" /tmp/omnipkg-artifacts/upgrade_output.txt || \ | |
| grep -q "LATEST-ACTIVE STRATEGY: Preserving replaced versions" /tmp/omnipkg-artifacts/upgrade_output.txt; then | |
| echo "✅ Old version (2.28.0) was bubbled!" | |
| else | |
| echo "⚠️ Could not verify bubble creation from output" | |
| fi | |
| - name: Verify Upgraded Version | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Verifying upgraded requests version ---" | |
| omnipkg info requests 2>&1 | tee /tmp/omnipkg-artifacts/info_after_upgrade.txt | |
| echo "## requests Info After Upgrade" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/omnipkg-artifacts/info_after_upgrade.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| # Extract active version (should be latest, not 2.28.0) | |
| ACTIVE_VERSION=$(grep "Active Version:" /tmp/omnipkg-artifacts/info_after_upgrade.txt | awk '{print $3}') | |
| echo "Active version after upgrade: $ACTIVE_VERSION" | |
| # Verify it's not 2.28.0 anymore | |
| if [[ "$ACTIVE_VERSION" != "2.28.0" ]]; then | |
| echo "✅ Confirmed: requests upgraded from 2.28.0 to $ACTIVE_VERSION" | |
| else | |
| echo "❌ requests is still on version 2.28.0, upgrade failed" | |
| exit 1 | |
| fi | |
| # Verify old version is bubbled | |
| if grep -q "Bubbled Versions:" /tmp/omnipkg-artifacts/info_after_upgrade.txt && \ | |
| grep -q "2.28.0" /tmp/omnipkg-artifacts/info_after_upgrade.txt; then | |
| echo "✅ Old version (2.28.0) is preserved in bubble" | |
| else | |
| echo "⚠️ Could not verify bubble presence for old version" | |
| fi | |
| - name: Test Package Functionality | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Testing upgraded requests package ---" | |
| # Test that requests can be imported and used | |
| python -c "import requests; print(f'requests version: {requests.__version__}'); r = requests.get('https://httpbin.org/json'); print(f'Status: {r.status_code}')" 2>&1 | tee /tmp/omnipkg-artifacts/import_test.txt | |
| if [ $? -eq 0 ]; then | |
| echo "✅ Upgraded requests package works correctly!" | |
| else | |
| echo "❌ Failed to use upgraded requests package" | |
| exit 1 | |
| fi | |
| - name: Verify Bubble Swapping Works | |
| env: | |
| OMNIPKG_ENV_ID_OVERRIDE: ${{ env.OMNIPKG_ENV_ID_OVERRIDE }} | |
| run: | | |
| echo "--- Testing bubble swap back to old version ---" | |
| # Get the active version number | |
| ACTIVE_VERSION=$(omnipkg info requests 2>/dev/null | grep "Active Version:" | awk '{print $3}') | |
| # Try to swap to the bubbled version (2.28.0) using -y | |
| omnipkg install requests==2.28.0 -y 2>&1 | tee /tmp/omnipkg-artifacts/swap_to_old.txt | |
| # Verify swap worked | |
| NEW_ACTIVE=$(omnipkg info requests 2>/dev/null | grep "Active Version:" | awk '{print $3}') | |
| if [[ "$NEW_ACTIVE" == "2.28.0" ]]; then | |
| echo "✅ Successfully swapped back to bubbled version 2.28.0" | |
| echo "✅ Bubble swapping works correctly!" | |
| else | |
| echo "⚠️ Swap to old version may not have worked as expected" | |
| fi | |
| echo "## Bubble Swap Test" >> $GITHUB_STEP_SUMMARY | |
| echo "- Original active: $ACTIVE_VERSION" >> $GITHUB_STEP_SUMMARY | |
| echo "- Swapped to: 2.28.0" >> $GITHUB_STEP_SUMMARY | |
| echo "- Current active: $NEW_ACTIVE" >> $GITHUB_STEP_SUMMARY | |
| - name: Generate Test Summary | |
| if: always() | |
| run: | | |
| echo "## ⬆️ Package Upgrade Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Test Scenario" >> $GITHUB_STEP_SUMMARY | |
| echo "1. Set install strategy to 'latest-active'" >> $GITHUB_STEP_SUMMARY | |
| echo "2. Installed older version of requests (2.28.0)" >> $GITHUB_STEP_SUMMARY | |
| echo "3. Ran \`omnipkg upgrade requests\` command" >> $GITHUB_STEP_SUMMARY | |
| echo "4. Verified upgrade to latest version (with bubbling)" >> $GITHUB_STEP_SUMMARY | |
| echo "5. Tested bubble swapping back to old version" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Key Verifications" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Install strategy set to 'latest-active'" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Old version (2.28.0) installed correctly" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Upgrade command executed successfully" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ New version became active" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Old version preserved in bubble" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Package works correctly after upgrade" >> $GITHUB_STEP_SUMMARY | |
| echo "- ✅ Bubble swapping works (can revert to old version)" >> $GITHUB_STEP_SUMMARY | |
| - name: Archive Test Outputs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: omnipkg-package-upgrade-test-output | |
| path: /tmp/omnipkg-artifacts/ | |
| retention-days: 7 | |
| compression-level: 6 |