#!/bin/sh # Publish a v5 dataset, pin its revision into the request, then submit when the slot frees. # The Hugging Face token is only read through HF_TOKEN_PATH (never printed or passed as an argument). # Usage: sh scripts/publish_and_submit.sh set -u MODE=$1 START=$2 cd "$(dirname "$0")/.." || exit 1 until [ "$(date +%s)" -ge $((START - 600)) ]; do sleep 30; done .venv/bin/python scripts/build_dataset_v5.py --mode "$MODE" || exit 1 HF_TOKEN_PATH="$HOME/.config/hf-arena/token" .venv/bin/python -I - "$MODE" <<'PY' || exit 1 import json, sys from huggingface_hub import HfApi mode = sys.argv[1] req = json.load(open(f"submission_v5_{mode}_candidate.json")) repo = req["dataset"] api = HfApi() api.create_repo(repo, repo_type="dataset", private=False, exist_ok=True) info = api.upload_folder(repo_id=repo, repo_type="dataset", folder_path=f"dataset_v5_{mode}", commit_message=f"Five Desks v5 ({mode})") req["source"] = f"https://huggingface.co/datasets/{repo}/tree/{info.oid}/source" json.dump(req, open("submission_v5.json", "w"), indent=2) print("published", repo, info.oid) PY exec sh scripts/submit_when_open.sh "$START" submission_v5.json