Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80da0de
Add Workshop Nexus Intro code for Replay 2026
MasonEgger Apr 25, 2026
64af236
Restructure chapters, flatten package layout, trim Java to compliance…
MasonEgger Apr 26, 2026
a9a27f9
updates
MasonEgger Apr 27, 2026
9a7e749
Fix README cross-references, docstring drift, and Ch 7 starter error …
MasonEgger Apr 27, 2026
df44ba2
Apply suggestions from code review
nadvolod Apr 27, 2026
5a1150a
Apply suggestions from code review
nadvolod Apr 27, 2026
0c033be
Apply suggestion from @nadvolod
nadvolod Apr 27, 2026
80f750a
Apply suggestions from code review
nadvolod Apr 27, 2026
6735597
Update exercises/01_run_monolith/solution/payments/workflows.py
MasonEgger Apr 28, 2026
b100106
Update exercises/03_sync_handler/README.md
MasonEgger Apr 28, 2026
5b2f7a4
Update exercises/06_updates/solution/compliance/workflows.py
MasonEgger Apr 28, 2026
6f6d24b
Update exercises/06_updates/solution/compliance/workflows.py
MasonEgger Apr 28, 2026
06205e4
Update exercises/06_updates/solution/compliance/workflows.py
MasonEgger Apr 28, 2026
d41c121
Update exercises/06_updates/solution/compliance/service_handler.py
MasonEgger Apr 28, 2026
05d7213
updates
MasonEgger Apr 27, 2026
165dd89
Prefix workflow IDs with chapter number to stop cross-chapter contami…
MasonEgger Apr 28, 2026
d8620d0
Align exercise TODOs with assignment.md and the authoring standard
MasonEgger Apr 28, 2026
fc453a8
add interactive game
nadvolod Apr 29, 2026
20b7e18
Tighten compliance Rule 3 explanation, generalize submit_review stub,…
MasonEgger Apr 30, 2026
2c1c3d3
Document the topology sandbox visualizer in the README
MasonEgger Apr 30, 2026
08fbe4b
adding README for game
MasonEgger Apr 30, 2026
b1f0217
minor tweaks
MasonEgger May 3, 2026
fd23952
Merge branch 'main' into init
MasonEgger May 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions exercises/05_async_operations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,12 @@ While you are in the file, delete the now-unused `from compliance.activities imp

## Part C: Register the workflow + activity on the Compliance worker (TODO 8)

Open `compliance/worker.py`. The Ch 3/4 worker only registered the Nexus handler. Now that the handler starts a workflow and that workflow runs an activity, register both:
Open `compliance/worker.py`. The `with concurrent.futures.ThreadPoolExecutor(...) as executor:` block, the prints, and `await worker.run()` are already in place. Find the TODO 8 comment and add three arguments to the existing `Worker(...)` call, alongside `task_queue` and `nexus_service_handlers`:

```python
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
worker = Worker(
client,
task_queue=TASK_QUEUE,
workflows=[ComplianceWorkflow],
activities=[check_compliance],
activity_executor=executor,
nexus_service_handlers=[ComplianceNexusServiceHandler()],
)
workflows=[ComplianceWorkflow],
activities=[check_compliance],
activity_executor=executor,
```

The activity is registered as a plain `def` in `compliance/activities.py` (no `async`), so the worker needs an `activity_executor` to run it on a thread. We use a `ThreadPoolExecutor` here, the same pattern the Payments worker uses for its sync activities.
Expand Down
30 changes: 17 additions & 13 deletions exercises/05_async_operations/exercise/compliance/worker.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import asyncio
import concurrent.futures

from temporalio.client import Client
from temporalio.worker import Worker

from compliance.activities import check_compliance
from compliance.models import TASK_QUEUE
from compliance.service_handler import ComplianceNexusServiceHandler
from compliance.workflows import ComplianceWorkflow

NAMESPACE = "compliance-namespace"

async def main() -> None:
"""Compliance team's worker - hosts ComplianceWorkflow + check_compliance activity + Nexus handler."""
client = await Client.connect("localhost:7233", namespace=NAMESPACE)

# TODO 8: Register ComplianceWorkflow and the check_compliance activity on this
# Worker alongside the existing Nexus service handler, and supply an executor for
# the sync activity. See the assignment for the wrapping pattern.
worker = Worker(
client,
task_queue=TASK_QUEUE,
nexus_service_handlers=[ComplianceNexusServiceHandler()],
)
print("=========================================================")
print(f" Compliance Worker started on: {TASK_QUEUE}")
print(f" Namespace: {NAMESPACE}")
print("=========================================================")
await worker.run()
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
# TODO 8: Add three arguments to this Worker(...) call so it registers
# ComplianceWorkflow, the check_compliance activity, and the executor
# that runs the sync activity. See the assignment for the exact lines.
worker = Worker(
client,
task_queue=TASK_QUEUE,
nexus_service_handlers=[ComplianceNexusServiceHandler()],
)
print("=========================================================")
print(f" Compliance Worker started on: {TASK_QUEUE}")
print(f" Namespace: {NAMESPACE}")
print("=========================================================")
await worker.run()

if __name__ == "__main__":
asyncio.run(main())