Jobs 예약
Jobs 예약
HF 인프라에서 실행될 jobs를 예약하고 관리해요.
출처: 문서
본문
hf jobs uv run 또는 hf jobs run에 @annually, @yearly, @monthly, @weekly, @daily, @hourly 스케줄 또는 CRON 스케줄 표현식(예: 매주 월요일 오전 9시는 "0 9 * * 1")을 넣어 사용하세요:
# 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!')"
환경 변수, 시크릿, 타임아웃, 라벨 등을 전달하려면 hf jobs uv run과 hf jobs run과 같은 파라미터를 사용하세요.
hf jobs scheduled ps, hf jobs scheduled inspect, hf jobs scheduled suspend, hf jobs scheduled resume, hf jobs scheduled trigger, hf jobs scheduled delete로 예약 jobs를 관리하세요:
# List your active scheduled jobs
>>> hf jobs scheduled ps
# List all your scheduled jobs (including suspended jobs)
>>> hf jobs scheduled ps -a
# Inspect the status of a job
>>> hf jobs scheduled inspect <scheduled-job-id>
# Suspend (pause) a scheduled job
>>> hf jobs scheduled suspend <scheduled-job-id>
# Resume a scheduled job
>>> hf jobs scheduled resume <scheduled-job-id>
# 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>
더 알아보기 (Learn more)
- Jobs 개요로 Jobs 기본을 익혀 보세요.
- Webhooks로 Job 트리거로 이벤트 기반 자동화도 살펴보세요.