Skip to content

Add Worker snippets for the SDK Worker pages - #856

Merged
lennessyy merged 2 commits into
mainfrom
docs/worker-page-snippets
Jul 28, 2026
Merged

Add Worker snippets for the SDK Worker pages#856
lennessyy merged 2 commits into
mainfrom
docs/worker-page-snippets

Conversation

@lennessyy

Copy link
Copy Markdown
Contributor

What

Adds snippet regions to features/snippets/worker/ for the per-SDK Run a Worker documentation pages.

New snippet IDs:

Go Python TypeScript
Create and run python-create-worker
Versioned Worker go-versioned-worker python-versioned-worker typescript-versioned-worker
Graceful shutdown python-worker-graceful-shutdown typescript-worker-graceful-shutdown

Why

The run-worker-process docs pages currently use hand-written inline code, and none of the eight SDK Worker pages document a versioned Worker at all. These snippets give those pages a compile-checked source.

Go and TypeScript pull their create-and-run snippet from the hello-world samples instead, so only Python needs one here — its hello sample runs the client inside the Worker's async with block, so there's no clean region to mark.

Notes

  • Placeholder Workflow and Activity names follow the existing snippets/plugins convention: HelloWorkflow, some_activity.
  • Markers stay tight around the Worker construction, matching the existing *-worker-max-cached-workflows snippets in these files.
  • worker.go also picks up a trailing newline it was missing.

Verification

  • go build ./snippets/worker/ passes against SDK v1.45.0.
  • Python API names verified by introspecting an installed temporalio: deployment_config and graceful_shutdown_timeout are real Worker params, and the WorkerDeploymentConfig / WorkerDeploymentVersion field names match.
  • TypeScript checked against the published 1.18.1 declarations: workerDeploymentOptions exists, shutdownGraceTime accepts an ms-formatted string, and defaultVersioningBehavior is required when useWorkerVersioning: true. I did not run tsc locally, so CI is the real check there.

Adds snippet regions used by the Run a Worker pages in the docs:

- go-versioned-worker
- python-create-worker, python-versioned-worker, python-worker-graceful-shutdown
- typescript-versioned-worker, typescript-worker-graceful-shutdown

Placeholder Workflow and Activity names follow the existing
snippets/plugins convention (HelloWorkflow, some_activity).
@lennessyy
lennessyy enabled auto-merge (squash) July 28, 2026 21:04
@lennessyy
lennessyy merged commit 3571c0d into main Jul 28, 2026
26 checks passed
@lennessyy
lennessyy deleted the docs/worker-page-snippets branch July 28, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants