Skip to content

Test Concurrency Groups #1

Test Concurrency Groups

Test Concurrency Groups #1

name: Test Concurrency Groups
on:
workflow_dispatch:
inputs:
max_parallel:
description: 'Max parallel jobs (1-10)'
required: true
default: '2'
type: choice
options:
- '1'
- '2'
- '3'
- '5'
- '10'
job_count:
description: 'Number of jobs to run'
required: true
default: '10'
type: choice
options:
- '5'
- '10'
- '20'
- '37'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
max_parallel: ${{ github.event.inputs.max_parallel }}
steps:
- id: set-matrix
run: |
COUNT=${{ github.event.inputs.job_count }}
# Generate matrix array
MATRIX=$(seq 1 $COUNT | jq -R . | jq -s .)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Generated matrix with $COUNT jobs"
dummy-job:
needs: setup
runs-on: [self-hosted, modal, "job-${{ github.run_id }}-${{ github.job }}", "max-parallel-${{ github.event.inputs.max_parallel }}"]
name: Dummy Job ${{ matrix.job }} (Modal)
strategy:
fail-fast: false
max-parallel: ${{ fromJson(github.event.inputs.max_parallel) }}
matrix:
job: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Job Start
run: |
echo "========================================="
echo "Job ${{ matrix.job }} starting"
echo "Max parallel: ${{ github.event.inputs.max_parallel }}"
echo "Total jobs: ${{ github.event.inputs.job_count }}"
echo "Start time: $(date)"
echo "Runner: $(hostname)"
echo "========================================="
- name: Simulate Work
run: |
echo "Simulating API calls like daily-search..."
for i in {1..5}; do
echo " API call $i/5 at $(date)"
sleep 10
done
- name: Job Complete
if: always()
run: |
echo "========================================="
echo "Job ${{ matrix.job }} completed"
echo "End time: $(date)"
echo "========================================="