/frappe-apps-manager:frappe-background-jobsfrom frappe-apps-manager
Manages background jobs and scheduled tasks in the Frappe framework using frappe.enqueue and Python RQ. Covers queue types, hook-based scheduling, and failure handling.
Ships in frappe-apps-manager. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Implement and manage asynchronous tasks and scheduled jobs in the Frappe Framework.
import frappe
# Simple enqueue
frappe.enqueue(
'my_app.tasks.process_data',
queue='long',
timeout=600,
data=data_object
)
# Enqueue with document context
frappe.enqueue(
'my_app.tasks.generate_report',
queue='default',
doc=doc,
user=frappe.session.user
)
short: Tasks taking < 2 minutesdefault: Tasks taking 2-10 minuteslong: Tasks taking up to 30 minutesIn hooks.py:
scheduler_events = {
"all": [
"my_app.tasks.all"
],
"daily": [
"my_app.tasks.daily_cleanup"
],
"hourly": [
"my_app.tasks.hourly_update"
],
"weekly": [
"my_app.tasks.weekly_report"
],
"monthly": [
"my_app.tasks.monthly_billing"
],
"cron": {
"0 0 * * *": [
"my_app.tasks.midnight_job"
]
}
}
def process_data(data):
try:
# Business logic here
pass
except Exception as e:
frappe.log_error(frappe.get_traceback(), "Background Job Failed")
# Optional: Notify user or retry logic
frappe.db.commit() only when necessary and understand its impact on background jobs.bench worker to manage workers and frappe.get_all("Scheduled Job Log") to monitor scheduled tasks.timeout for jobs that might run longer than the default.Remember: This skill is model-invoked. Claude will use it autonomously when detecting background processing or scheduling requirements.
Need periodic execution?
├─ Fixed interval (hourly / daily / weekly / monthly)
│ → scheduler_events in hooks.py (parameterless handlers)
├─ Custom schedule
│ → scheduler_events["cron"] in hooks.py (croniter-compatible expressions)
├─ User-configurable interval
│ → Scheduled Job Type DocType
└─ No — triggered by user / event / code
├─ Method on a specific document → frappe.enqueue_doc(...)
├─ Standalone function async → frappe.enqueue(...)
└─ From Document controller → self.queue_action(...)
Main fork: scheduler_events vs frappe.enqueue
| Aspect | scheduler_events | frappe.enqueue |
|---|---|---|
| Trigger | Time / interval | Code execution |
| Definition | hooks.py | Call site |
| Arguments | NONE (handlers must be parameterless) | Serializable kwargs |
| Typical use | Maintenance, sync on a schedule | User-triggered or event-driven async work |
| Need | Event key | Default queue implication |
|---|---|---|
Every scheduler tick (all: v14 ~240s, v15+ ~60s) | all | default — keep handler very short |
| Hourly | hourly / hourly_long | Use *_long if work can exceed ~5 minutes |
| Daily | daily / daily_long | Same |
| Weekly | weekly / weekly_long | Same |
| Monthly | monthly / monthly_long | Same |
| Custom timing | "cron": { "expr": [...] } | Put heavy work in _long or enqueue from thin handler |
Built-in scheduler_events keys: all, hourly, daily, weekly, monthly, hourly_long, daily_long, weekly_long, monthly_long, plus cron mapping expressions to dotted task paths.
frappe.enqueue)| Queue | Default timeout | Use when |
|---|---|---|
short | 300s (5 min) | Very quick tasks (order of seconds) |
default | 300s (5 min) | Routine background work (~30s–5 min) |
long | 1500s (25 min) | Heavy work up to ~25 min |
Custom timeout= | Overrides queue default | Longer jobs; split work >25 min into chained batches |
# Common parameters (subset)
frappe.enqueue(
method, # required: callable or "dotted.module.path"
queue="default", # "short", "default", "long", or custom
timeout=None, # seconds; overrides queue default
is_async=True, # False = synchronous path
now=False, # True = frappe.call()-style immediate run
job_id=None, # [v15+] deduplication key
enqueue_after_commit=False, # wait for DB commit before enqueue (e.g. after save)
at_front=False,
on_success=None,
on_failure=None,
**kwargs, # forwarded to target
)
Cron field layout (croniter-compatible): minute hour day-of-month month day-of-week.
| Symbol | Meaning | Example |
|---|---|---|
* | any | run every occurrence of that field |
, | list | 1,15 in minute = minutes 1 and 15 |
- | range | 9-17 in hour |
/ | step | */10 every 10 units of that field |
Common examples: every 5 min */5 * * * *; weekdays 09:00 0 9 * * 1-5; monthly 1st 0 0 1 * *.
bench migrate after any scheduler_events change so registration updates.owner / permissions explicitly when creating docs.enqueue (or enqueue_doc / queue_action) for heavy work; keep scheduler entry points thin.job_id with frappe.utils.background_jobs.is_job_enqueued(job_id) for deduplication on v15+ user-triggered jobs.timeout from expected duration; specify queue= explicitly in new code (do not rely on implicit defaults alone).job_name for deduplication in new code; use job_id [v15+].all/tick handlers — enqueue downstream jobs.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub vyogotech/frappe-apps-manager --plugin frappe-apps-manager90 skills in this plugin
/frappe-add-service-composeAdd a new microservice to dev-podman-compose.yml with proper configuration, dependencies, and networking./frappe-agent-debuggerUse when debugging Frappe errors, using bench console for live inspection, analyzing tracebacks, or reading Frappe log files. Prevents wasted debugging time from ignoring log context, misreading tracebacks, and not using bench console effectively. Covers bench console, frappe.logger, error log DocType, traceback analysis, common error patterns, log file locations, pdb/debugger integration, VS Code DAP, profiling, Frappe Recorder, mariadb diagnostics. Keywords: debug, bench console, traceback, error log, frappe.logger, pdb, debugging, log analysis, inspect, VS Code, DAP, profiling, recorder, mariadb, monitor, ERPNext error, how to debug, find the bug, what went wrong, stack trace, error message..
/frappe-agent-interpreterUse when receiving vague or unclear ERPNext/Frappe development requests that need interpretation. Transforms requirements like 'make invoice auto-calculate' or 'add approval workflow' into concrete technical specifications. Determines which Frappe mechanisms to use and maps to the full 61-skill catalog. Keywords: vague requirement, clarify scope, translate business need, technical spec, implementation plan, what does this mean, unclear requirement, translate to code, how to build this.
Other plugins' skills for the same job