Skip to main content

Temporal

Maybern uses Temporal for managing cron jobs and one-off scheduled tasks. Temporal provides durable execution guarantees and a UI for monitoring workflows.

What is Temporal?

Temporal is a workflow orchestration platform that:
  • Runs scheduled/cron tasks reliably
  • Provides visibility into running workflows
  • Handles retries and failures gracefully
  • Maintains execution history

Accessing Temporal

Access Temporal Cloud at cloud.temporal.ioLogin via SSO with your Maybern email.

Running Workers

Local Development

Start the Temporal worker:
./run_worker.sh
Alternatively, run management commands directly:
./manage.py [name_of_backfill_function]

Running Workflows

Workflows are submitted to the shared-task-queue:

Example: Running a Backfill

To run a dry run of a backfill workflow:
FieldValue
Workflow IDRandom UUID
Task Queueshared-task-queue
Workflow TypeRunManagementCommandWorkflow
Input:
{
  "name": "backfill_cancel_correct_equalizations",
  "args": ["--dry-run"]
}

Viewing Logs

Workflow logs are available in Datadog:
container_name:temporal-worker env:<env>
Where <env> is one of:
  • dev
  • corp
  • prod

Common Workflows

WorkflowDescription
RunManagementCommandWorkflowRuns Django management commands
Backfill workflowsData migration and correction
Scheduled reportsPeriodic report generation

Best Practices

Temporal is ideal for:
  • Multi-step workflows
  • Tasks that need to survive restarts
  • Operations requiring audit trails
Use Celery for:
  • Real-time computation
  • User-triggered async tasks
  • High-throughput processing
Use Temporal for:
  • Scheduled/cron jobs
  • Backfills and migrations
  • Workflows needing durability guarantees
For backfills and data modifications, always run with --dry-run first:
{
  "name": "my_backfill",
  "args": ["--dry-run"]
}
Review the output before running without the flag.

Next Steps