Estimate Memory #44
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: Estimate Memory | |
| on: | |
| workflow_dispatch: | |
| # Defines environment variables for the workflow | |
| env: | |
| REGISTRY: ghcr.io | |
| SERVICE_URI: 'http://127.0.0.1:5400' | |
| REPO_URL: 'https://github.com/tercen/plot_operator' | |
| REPO_BRANCH: 'mem_estimate' | |
| TEAM_NAME: 'test' | |
| jobs: | |
| estimate-memory: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| memory-estimate: ${{ steps.save-output.outputs.result }} | |
| steps: | |
| - name: Start tercen server | |
| uses: tercen/actions/start-tercen@main | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3.3.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run memory estimator | |
| id: run-estimator | |
| run: | | |
| docker run --rm --net=host --pull always \ | |
| -v ${{ github.workspace }}:/output \ | |
| ${{ env.REGISTRY }}/tercen/memory_estimator:main \ | |
| --username ${{ secrets.TERCEN_USER }} \ | |
| --password ${{ secrets.TERCEN_PASSW }} \ | |
| --repo-url ${{ env.REPO_URL }} \ | |
| --repo-branch ${{ env.REPO_BRANCH }} \ | |
| --team-name ${{ env.TEAM_NAME }} \ | |
| --tercen-url ${{ env.SERVICE_URI }} \ | |
| --output /output/run_estimate.csv | |
| - name: Save output | |
| id: save-output | |
| run: | | |
| echo "result=$(cat run_estimate.json | jq -c .)" >> $GITHUB_OUTPUT | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: run_estimate | |
| path: ${{ github.workspace }}/run_estimate.csv | |
| create-models: | |
| runs-on: ubuntu-latest | |
| needs: estimate-memory | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: run_estimate | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3.3.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run memory model estimator | |
| run: | | |
| docker pull ${{ env.REGISTRY }}/tercen/model_estimator:main | |
| docker run --rm -v ${{ github.workspace }}:/data \ | |
| ${{ env.REGISTRY }}/tercen/model_estimator:main \ | |
| --target-column estimated_ram_mb \ | |
| --max-delta-aic 4 \ | |
| --ignore-columns runtime_seconds \ | |
| --output /data/memory \ | |
| /data/run_estimate.csv | |
| - name: Run runtime model estimator | |
| run: | | |
| docker run --rm -v ${{ github.workspace }}:/data \ | |
| ${{ env.REGISTRY }}/tercen/model_estimator:main \ | |
| --target-column runtime_seconds \ | |
| --ignore-columns estimated_ram_mb \ | |
| --max-delta-aic 4 \ | |
| --output /data/runtime \ | |
| /data/run_estimate.csv | |
| - name: Commit all model files | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add memory_model.json memory_simple_model.png runtime_model.json runtime_simple_model.png | |
| git commit -m "Update memory and runtime models [skip ci]" || echo "No changes to commit" | |
| git push | |
| - name: Upload model artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: models | |
| path: | | |
| ${{ github.workspace }}/memory_model.json | |
| ${{ github.workspace }}/memory_simple_model.png | |
| ${{ github.workspace }}/runtime_model.json | |
| ${{ github.workspace }}/runtime_simple_model.png |