xiaohongshu
xiaohongshu
beat-scheduling
Periodic task scheduling patterns with Celery Beat (crontab, interval, solar). Use when configuring periodic tasks, setting up task schedules, implementing recurring jobs, configuring django-celery-beat, or creating dynamic schedules.
Full skill instructions
Provides comprehensive patterns and templates for implementing periodic task scheduling with Celery Beat, including crontab, interval, and solar schedules.
Generate crontab-based schedules with precise timing control:
# See templates/crontab-schedule.py for complete implementation
from celery.schedules import crontab
app.conf.beat_schedule = {
'daily-report': {
'task': 'tasks.generate_report',
'schedule': crontab(hour=0, minute=0), # Midnight daily
},
'business-hours': {
'task': 'tasks.process_orders',
'schedule': crontab(hour='9-17', minute='*/15', day_of_week='mon-fri'),
}
}
Key patterns:
Simple interval-based recurring tasks:
# See templates/interval-schedule.py for complete implementation
from celery.schedules import schedule
app.conf.beat_schedule = {
'every-30-seconds': {
'task': 'tasks.check_status',
'schedule': 30.0, # Execute every 30 seconds
},
'every-hour': {
'task': 'tasks.cleanup',
'schedule': timedelta(hours=1),
}
}
Key patterns:
Event-based scheduling using solar calculations:
# See templates/solar-schedule.py for complete implementation
from celery.schedules import solar
app.conf.beat_schedule = {
'morning-task': {
'task': 'tasks.sunrise_routine',
'schedule': solar('sunrise', 40.7128, -74.0060), # NYC coordinates
}
}
Supported events: sunrise, sunset, dawn_civil, dusk_astronomical, solar_noon
Database-backed dynamic schedules:
# See templates/django-celery-beat.py for complete implementation
# Schedules stored in Django database, editable via Django Admin
INSTALLED_APPS += ['django_celery_beat']
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
Benefits:
Programmatic schedule registration:
# See templates/dynamic-schedules.py for complete implementation
from celery import Celery
app = Celery('tasks')
@app.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
# Add tasks programmatically
sender.add_periodic_task(30.0, check_status.s(), name='status-check')
sender.add_periodic_task(
crontab(hour=7, minute=30),
morning_report.s(),
name='morning-report'
)
File: templates/crontab-schedule.py
Use for precise timing requirements:
File: templates/interval-schedule.py
Use for fixed interval tasks:
File: templates/solar-schedule.py
Use for location-based timing:
File: templates/django-celery-beat.py
Use for runtime schedule management:
File: templates/dynamic-schedules.py
Use for programmatic configuration:
Validates schedule configuration syntax and structure.
Usage:
bash scripts/validate-schedule.sh <config-file>
Checks:
Tests Celery Beat configuration and execution.
Usage:
bash scripts/test-beat.sh <celery-app>
Tests:
Determine the appropriate scheduling pattern:
Load the appropriate template for your schedule type:
# For crontab schedules
Read: templates/crontab-schedule.py
# For interval schedules
Read: templates/interval-schedule.py
# For Django integration
Read: templates/django-celery-beat.py
Customize the template with your task details:
Run validation to catch errors:
bash scripts/validate-schedule.sh celeryconfig.py
Verify schedule works as expected:
bash scripts/test-beat.sh myapp
Start Celery Beat in production:
celery -A myapp beat --loglevel=info
'daily-report': {
'task': 'reports.generate_daily',
'schedule': crontab(hour=0, minute=0),
}
'business-hours-sync': {
'task': 'sync.external_api',
'schedule': crontab(hour='9-17', minute='*/15', day_of_week='mon-fri'),
}
'health-check': {
'task': 'monitoring.check_services',
'schedule': 30.0, # Every 30 seconds
}
'weekend-cleanup': {
'task': 'maintenance.cleanup',
'schedule': crontab(hour=2, minute=0, day_of_week='sat,sun'),
}
This skill follows strict security rules:
.gitignore protection documentedapp.conf.timezone = 'UTC'expires option to prevent old task executionSee examples/ directory for detailed implementation examples:
crontab-examples.md - Comprehensive crontab schedule patternsinterval-examples.md - Interval schedule use casesdjango-celery-beat-setup.md - Complete Django integration guidexiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience