Hub documentation

جدولة المهام

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

جدولة المهام

جدولة وإدارة المهام التي ستُنفَّذ على بنية HF التحتية.

استخدم hf jobs uv run أو hf jobs run مع جدول زمني @annually، @yearly، @monthly، @weekly، @daily، @hourly، أو تعبير جدول CRON (مثل "0 9 * * 1" للساعة 9 صباحاً كل يوم اثنين):

# 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 reschedule وhf jobs scheduled trigger وhf jobs scheduled delete:

# 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>

# 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>
Update on GitHub