Goal
By the end of this guide, you’ll have a workflow running automatically every 5 minutes in Spark. Total time: under 10 minutes. This is your “hello world” for Spark scheduling—the simplest possible path from installation to automated workflow execution.Prerequisites
Before starting, ensure you have:1
Spark installed and running
Complete the installation guide first.Required services:
- PostgreSQL (running on port 5432)
- Redis (running on port 6379)
- Spark API (running on port 8883)
2
A workflow source available
You need either:
- LangFlow running on
http://localhost:7860, OR - Automagik Hive running on
http://localhost:8000
Don’t have one? Quickly install LangFlow:Then create a simple flow (any flow works for this example).
3
API key from your source
Get an API key from your LangFlow or Hive instance. You’ll need this to connect Spark to your workflow source.
Quick Prerequisites Check
Run these commands to verify everything is ready:All checks must pass before proceeding. If any fail, see common errors for fixes.
Step-by-Step: Schedule in 10 Minutes
1
Add Your Workflow Source
Connect Spark to your LangFlow or Hive instance.For LangFlow:For Hive:Expected output:
What this does: Registers your workflow source with Spark so it can discover and sync workflows.
2
List Available Workflows
Discover what workflows are available to schedule.Expected output:Note the workflow ID you want to schedule (e.g.,
flow-abc-123).What this does: Queries your source for all available workflows without syncing them yet. This is your discovery phase.
3
Sync the Workflow
Bring your chosen workflow into Spark’s database.Expected output:Verify it was synced:Expected output:
What this does: Copies the workflow metadata into Spark’s database so it can be scheduled and executed locally.
4
Create a Schedule (Every 5 Minutes)
Set up the workflow to run automatically every 5 minutes.Interactive prompts and responses:
Cron expression breakdown:
*/5 * * * **/5= Every 5 minutes*= Every hour*= Every day of month*= Every month*= Every day of week
What this does: Creates a database entry that Celery Beat monitors. Every 5 minutes, Beat creates a task that workers execute.
5
Verify the Schedule
Confirm your schedule was created and is active.Expected output:Key things to check:
- ✅ Status is ACTIVE (not PAUSED or STOPPED)
- ✅ Next Run shows a future time
- ✅ Expression matches what you entered
What this does: Shows you all configured schedules and when they’ll next execute. The “Next Run” time counts down to the next execution.
6
Check Workers Are Running
Verify Spark workers and scheduler are running.Expected output:If workers are NOT running:
Critical: Without workers running, schedules will NOT execute. Always ensure workers are running.
What this does: Workers execute tasks. Beat creates tasks from schedules. Both must run for automation to work.
7
Wait for First Execution (Up to 5 Minutes)
Your schedule will fire within 5 minutes. Meanwhile, check the task list.After 5 minutes, expected output:
Timeline:
- 0:00 - Schedule created
- 0:00-5:00 - Waiting for first cron trigger
- 5:00 - First task created and executed
- 10:00 - Second task executed
- Every 5 minutes - New task executed
What this does: Confirms your schedule is working. Each execution creates a task record with status, logs, and output.
8
View Execution Logs
Check the output from your workflow execution.Expected output:
What this does: Shows you everything that happened during execution—input sent, output received, logs, timing.
9
Control the Schedule
Pause, resume, or modify your schedule.Pause the schedule:Resume the schedule:Change the frequency:Delete the schedule:
What this does: Gives you full control over your automation. Pause during maintenance, adjust frequency based on needs, or clean up when done.
10
Clean Up (Optional)
When you’re done testing, remove the schedule and workflow.
What this does: Cleans up test resources. In production, you’d keep these running indefinitely.
Expected Timeline
Here’s what to expect when following this guide:| Time | Action | What’s Happening |
|---|---|---|
| 0:00 | Start guide | Prerequisites ready |
| 2:00 | Source added, workflow synced | Workflow now in Spark database |
| 3:00 | Schedule created | Automation configured |
| 4:00 | Workers verified, waiting | Beat monitoring schedule |
| 5:00 | First execution | Task created and executed |
| 10:00 | Second execution | Automation running on schedule |
| Total | Under 10 minutes ✅ | Fully automated workflow |
Most time is waiting: Setup takes 3-4 minutes. The rest is waiting for the 5-minute schedule to fire.
Verification Commands
Use these commands to verify each step worked:Common Mistakes
Schedule created but tasks never appear
Schedule created but tasks never appear
Problem: Workers not running or Beat scheduler not started.Solution:What to look for: Both “Worker is running” AND “Beat scheduler is running” must show.
Wrong cron syntax causes error
Wrong cron syntax causes error
Problem: Invalid cron expression entered.Common mistakes:
- ❌
5 * * * *(runs at minute 5 of every hour, not every 5 minutes) - ❌
* * * * * *(6 fields—cron uses 5 fields only) - ❌
*/5(incomplete expression)
*/5 * * * *Solution: Use crontab.guru to validate expressions before entering.Schedule shows PAUSED status
Schedule shows PAUSED status
Problem: Schedule was manually paused or created in paused state.Solution:
Task shows FAILED status
Task shows FAILED status
Problem: Workflow execution failed (source unreachable, bad input, etc.).Solution:
Workers start but immediately stop
Workers start but immediately stop
Problem: Redis or PostgreSQL connection failure.Solution:See common errors for detailed connection troubleshooting.
Troubleshooting
If something doesn’t work, check these in order:1
Verify prerequisites
2
Check workers are running
3
Verify schedule is ACTIVE
4
Check worker logs
5
Test workflow manually
What You’ve Accomplished
Congratulations! You’ve successfully:
- Connected Spark to a workflow source
- Synced a workflow into Spark
- Created a schedule that runs every 5 minutes
- Verified execution and viewed logs
- Learned how to control and manage schedules
- ⏰ Beat scheduler triggers the schedule
- 📋 Creates a new task in the queue
- 👷 Worker picks up the task
- 🚀 Executes the workflow via adapter
- ✅ Logs results and completion
Next Steps
LangFlow Integration
Deep dive into LangFlow workflows with detailed input/output mapping
Hive Integration
Learn how to schedule Hive agents, teams, and workflows
Production Deployment
Deploy Spark to production with Docker Compose and scaling
CLI Commands
Complete reference for all Spark CLI commands
Quick Reference: Common Schedules
Copy-paste these cron expressions for common scheduling patterns:| Schedule Pattern | Cron Expression | Description |
|---|---|---|
| Every minute | * * * * * | Testing only (creates many tasks) |
| Every 5 minutes | */5 * * * * | Frequent monitoring |
| Every 15 minutes | */15 * * * * | Regular polling |
| Every 30 minutes | */30 * * * * | Moderate frequency |
| Every hour | 0 * * * * | Hourly reports |
| Every 2 hours | 0 */2 * * * | Periodic checks |
| Every day at 8 AM | 0 8 * * * | Daily morning reports |
| Every day at midnight | 0 0 * * * | Daily batch processing |
| Every weekday at 9 AM | 0 9 * * 1-5 | Business day automation |
| Every Monday at 10 AM | 0 10 * * 1 | Weekly reports |
| First day of month at 9 AM | 0 9 1 * * | Monthly reports |
Use crontab.guru to build and validate complex cron expressions.
Complete Example Script
Here’s the entire guide as a single script you can copy and run:- Save as
setup-schedule.sh - Make executable:
chmod +x setup-schedule.sh - Update API key in Step 1
- Run:
./setup-schedule.sh
You’ve now mastered the basics of Spark scheduling. From here, you can build complex automation workflows, integrate multiple sources, and scale to production deployments.

