Skip to content

Add guide: Migrate a Celery task queue to a Temporal Workflow - #5116

Draft
brianmacdonald-temporal wants to merge 4 commits into
mainfrom
celery-to-workflow
Draft

Add guide: Migrate a Celery task queue to a Temporal Workflow#5116
brianmacdonald-temporal wants to merge 4 commits into
mainfrom
celery-to-workflow

Conversation

@brianmacdonald-temporal

@brianmacdonald-temporal brianmacdonald-temporal commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a new Python guide, Migrate a Celery Task Queue to a Temporal Workflow, that walks through converting a Celery application to Temporal one piece at a time:

  • A table mapping Celery concepts to Temporal primitives (task → Activity, broker → Temporal Service, Beat → Schedule, and so on)
  • Converting a Celery task into an Activity and orchestrating it with a Workflow
  • Running a Worker
  • Replacing .delay() with client.start_workflow()
  • Migrating max_retries / self.retry() to a Retry Policy
  • Replacing Celery Beat with a Temporal Schedule
  • (Optional) Translating Canvas chain / group / chord pipelines

Also links the page from the Guides sidebar and adds a card to the Guides grid under a new Migration tag.

Notes to reviewers

  • yarn build passes.
  • vale --config .vale-ci.ini docs/guides/celery-to-workflow.mdx reports 0 errors and 0 warnings. Three heading suggestions remain, all false positives on product names the rule does not know: "Celery task", "Celery Beat", and "Canvas workflows".
  • Migration is a new tag in the Guides grid — flagging in case you would rather reuse an existing one.
  • The code samples are inline rather than Snipsync-backed, matching the other guides in this section. Happy to move them to a CI-tested sample repo if preferred.

🤖 Generated with Claude Code

┆Attachments: EDU-6960 Add guide: Migrate a Celery task queue to a Temporal Workflow

Add docs/guides/celery-to-workflow.mdx, a Python guide that walks
through converting a Celery application to Temporal one piece at a
time: mapping Celery concepts to Temporal primitives, turning a task
into an Activity, orchestrating it with a Workflow, running a Worker,
replacing .delay() with client.start_workflow(), migrating task
retries to a Retry Policy, replacing Celery Beat with a Temporal
Schedule, and translating Canvas workflows.

Link the page from the Guides sidebar and add a card to the Guides
grid under a new "Migration" tag.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@brianmacdonald-temporal
brianmacdonald-temporal requested a review from a team as a code owner August 14, 2026 18:08
Copilot AI balanced review requested due to automatic review settings August 14, 2026 18:08
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview Aug 14, 2026 6:28pm

Request Review

Comment thread docs/guides/celery-to-workflow.mdx
Comment thread docs/guides/celery-to-workflow.mdx
Comment thread docs/guides/celery-to-workflow.mdx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Python guide for migrating Celery tasks, retries, schedules, and Canvas pipelines to Temporal.

Changes:

  • Adds the migration guide and Python examples.
  • Adds the guide to navigation.
  • Adds a Migration card to the Guides grid.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
docs/guides/celery-to-workflow.mdx Adds the migration tutorial.
sidebars.js Adds the guide to the sidebar.
src/components/GuidesGrid/guides-data.json Adds the guide card and Migration tag.
Suppressed comments (3)

docs/guides/celery-to-workflow.mdx:100

  • Capitalize “Temporal Service,” which is the required proper noun for the Temporal backend (readme/STYLE.md:24-31).
You will see the installed version printed to your terminal. With the tools installed, you can start a local Temporal service.

docs/guides/celery-to-workflow.mdx:104

  • Capitalize “Temporal Service,” which is the required proper noun for the Temporal backend (readme/STYLE.md:24-31).
In Celery, work flows through a broker such as Redis. In Temporal, work flows through the Temporal service, which also stores each Workflow's durable history. In this step, you will start a local development server that stands in for that service.

docs/guides/celery-to-workflow.mdx:539

  • Capitalize “Temporal Service,” which is the required proper noun for the Temporal backend (readme/STYLE.md:24-31).
- Self-hosting the Temporal service or using [Temporal Cloud](https://docs.temporal.io/) instead of the development
  server.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/guides/celery-to-workflow.mdx Outdated
description: Migrate Celery tasks to Temporal Workflows and Activities.
sidebar_label: Migrate from Celery
toc_max_heading_level: 3
author: n/a

[Celery](https://docs.celeryq.dev/en/stable/) is a distributed task queue that runs background jobs by pushing messages through a broker (such as Redis or RabbitMQ) to a pool of worker processes. It is a popular choice for sending emails, processing uploads, and running scheduled jobs. As applications grow, however, teams often want stronger guarantees than a broker provides: automatic recovery after a crash, a durable record of every job's progress, and built-in retries.

Temporal provides those guarantees. Instead of enqueueing a message and waiting for a worker to finish it, you run a _Workflow_ whose entire state is persisted by the Temporal service. If a Worker crashes mid-job, another Worker resumes exactly where it left off.
Comment thread docs/guides/celery-to-workflow.mdx Outdated
Comment thread docs/guides/celery-to-workflow.mdx Outdated
Result: sent to user@example.com
```

Note how the Celery patterns translate. A fire-and-forget `.delay()` corresponds to `start_workflow`, which returns a handle immediately. Retrieving the return value with `AsyncResult.get()` corresponds to `handle.result()`. The `id` you provide is a business identifier you choose (an order number, a user ID); Temporal uses it to guarantee that the same Workflow is never started twice, which is a built-in form of deduplication.

In Celery, retries are your responsibility: you set `max_retries` and call `self.retry()` inside the task. In Temporal, retries are automatic and declarative. In this step, you will restore your task's retry behavior by attaching a retry policy to the Activity call.

By default, Temporal retries a failed Activity indefinitely with exponential backoff. To reproduce the Celery task's limit of five attempts, update the `execute_activity` call in `workflows/onboarding.py`:
)
```

Here, `maximum_attempts=5` mirrors Celery's `max_retries`, and `maximum_interval` caps the backoff between attempts. The `non_retryable_error_types` list names errors that should fail immediately without retrying — the equivalent of _not_ calling `self.retry()` for a permanent failure. To raise such an error from an Activity, use `ApplicationError` with `non_retryable=True`:
Comment on lines +338 to +342
retry_policy=RetryPolicy(
maximum_attempts=5,
maximum_interval=timedelta(minutes=1),
non_retryable_error_types=["InvalidUserError"],
),
@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge What it says on the label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants