Hub documentation
İşleri Zamanla
İşleri Zamanla
HF altyapısında çalışacak işleri planlayın ve yönetin.
hf jobs scheduled uv run veya hf jobs scheduled run komutlarını @annually, @yearly, @monthly, @weekly, @daily, @hourly zamanlamalarıyla veya bir CRON zamanlama ifadesiyle (ör. her Pazartesi saat 9:00 için "0 9 * * 1") kullanın:
# Schedule a job that runs every hour
>>> hf jobs scheduled uv run @hourly python -c "print('This runs every hour!')"
# Use the CRON syntax
>>> hf jobs scheduled uv run "*/5 * * * *" python -c "print('This runs every five minutes!')"
# Schedule with GPU
>>> hf jobs scheduled uv run --flavor a10g-small --with torch @hourly python -c 'import torch; print(f"This code ran with the following GPU: {torch.cuda.get_device_name()}")'
# Schedule with a Docker image
>>> hf jobs scheduled run @hourly python:3.12 python -c "print('This runs every hour!')"
# Schedule a Python script with a label
>>> hf jobs scheduled uv run --label fine-tuning @hourly my_script.py
# Schedule a named job (names show up in the UI and do not have to be unique)
>>> hf jobs scheduled run --name hourly-task @hourly python:3.12 python -c "print('This runs every hour!')"Ortam değişkenleri, gizli bilgiler, zaman aşımı, etiketler vb. iletmek için hf jobs uv run ve hf jobs run ile aynı parametreleri kullanın.
Varsayılan olarak, bir zamanlanmış iş, önceki çalıştırma hâlâ devam ederken yeni bir çalıştırma başlatmaz. Bu çalıştırma kuyruğa alınmaz, atlanır. Çalıştırmaların üst üste gelmesine izin vermek için --concurrency parametresini iletin; örneğin bir çalıştırma zamanlama aralığından daha uzun sürebiliyorsa:
>>> hf jobs scheduled uv run --concurrency @hourly my_script.pyPlanlı işi duraklatılmış olarak oluşturmak için --suspend parametresini geçin ve daha sonra hf jobs scheduled resume komutuyla başlatın.
hf jobs scheduled ps, hf jobs scheduled inspect, hf jobs scheduled labels, hf jobs scheduled suspend, hf jobs scheduled resume, hf jobs scheduled reschedule, hf jobs scheduled trigger ve hf jobs scheduled delete komutlarını kullanarak zamanlanmış işleri yönetin:
# List your active scheduled jobs
>>> hf jobs scheduled ps
# List all your scheduled jobs (including suspended jobs)
>>> hf jobs scheduled ps -a
# Filter scheduled jobs by status, label, or name
>>> hf jobs scheduled ps --status suspended
>>> hf jobs scheduled ps --label env=prod --name hourly-task
# Inspect the status of a job
>>> hf jobs scheduled inspect <scheduled-job-id>
# Update labels on a scheduled job (replaces existing labels; pass --name alone to rename)
>>> hf jobs scheduled labels <scheduled-job-id> --label env=prod --label team=ml
# Suspend (pause) a scheduled job
>>> hf jobs scheduled suspend <scheduled-job-id>
# Resume a scheduled job
>>> hf jobs scheduled resume <scheduled-job-id>
# Change when a scheduled job runs (here, 9 AM every Monday)
>>> hf jobs scheduled reschedule <scheduled-job-id> "0 9 * * 1"
# Trigger a scheduled job to run right now (does not change the schedule)
>>> hf jobs scheduled trigger <scheduled-job-id>
# Delete a scheduled job
>>> hf jobs scheduled delete <scheduled-job-id>