Scheduler #6158
This file contains 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: Scheduler | |
on: | |
workflow_dispatch: | |
jobs: | |
schedule: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux | |
env: | |
CACTUS_CONFIG: ${{ secrets.CACTUS_CONFIG }} | |
steps: | |
- uses: arch4edu/cactus/actions/upgrade-archlinux@main | |
- name: Install runtime dependencies | |
run: pacman -S --noconfirm --needed git python-mysqlclient python-typing_extensions | |
- uses: arch4edu/cactus/actions/setup-cactus@main | |
- uses: arch4edu/cactus/actions/checkout-repository@main | |
- name: Scheduling | |
id: schedule | |
run: | | |
start_time=$(date +%s) | |
while [ $(( $(date +%s) - start_time )) -lt $(( 5 * 3600 )) ]; do | |
(cd repository; git pull --rebase) | |
python -m cactus.scheduler.schedule repository | |
current_time=$(date +%s) | |
program_runtime=$(($current_time - $start_time)) | |
sleep 300 | |
done | |
echo "result=success" >> $GITHUB_OUTPUT | |
- name: Start a new scheduler | |
if: ${{ always() }} | |
run: | | |
[ -z "${{ steps.schedule.outputs.result }}" ] && sleep 900 | |
python -m cactus.scheduler.refresh |