Skip to content

Commit b19e0d4

Browse files
authored
Merge pull request #23 from temporalio/grant-onboarding-findings
Ready: Grant notes while onboarding to DSE and taking 102 courses.
2 parents 54a741b + 5ba3cc0 commit b19e0d4

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

exercises/debug-activity/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ does by using the Web UI to interpret the Event History.
4444

4545
Open the Web UI and navigate to the detail page for the Workflow
4646
Execution you just ran, which has the Workflow Type `PizzaWorkflow`
47-
and Workflow ID `pizza-workflow-order-XD001`).
47+
and Workflow ID `pizza-workflow-order-XD001`.
4848

4949
If the detail page still shows a status of Running, wait a few seconds
5050
and refresh the page. Once the page shows a status of Completed, use
@@ -87,7 +87,7 @@ Take a moment to switch to the Compact view, and if one of the rows in the
8787
table is expanded, click to collapse it. Do you find that this view makes
8888
it easier to see the Activities and Timer that ran during the execution?
8989

90-
Click "Expand All" near the upper-right corner of this table. Do you find
90+
Click "Expand All" at the top of this table. Do you find
9191
that this helps you to correlate Events related to the Activities and Timer?
9292

9393
Since the Web UI remembers the current view, be sure to click "Collapse All"
@@ -178,7 +178,7 @@ in the Workflow code, rather than in an Activity, since that is typically
178178
not prone to failure and unlikely to affect whether the Workflow executes
179179
in a deterministic manner. This exercise implemented it in the Activity,
180180
since you can deploy a fix to Activity code without a risk of causing a
181-
non-deterministic error. Later in this course, you'll learn how to safely
181+
non-deterministic error. As you learned earlier in this course, there are also ways to safely
182182
deploy changes to Workflow Definitions.
183183

184184
### This is the end of the exercise.

exercises/debug-activity/practice/tests/test_activities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def test_send_bill_typical_order():
4242
customer_id=12983,
4343
order_number="XD001",
4444
description="2 large cheese pizzas",
45-
amount=2600,
45+
amount=2600, # amount does not qualify for discount
4646
)
4747
activity_environment = ActivityEnvironment()
4848
activities = PizzaOrderActivities()

exercises/durable-execution/practice/workflow.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class TranslationWorkflow:
1818

1919
workflow.logger.workflow_info_on_message = False
20-
workflow.logger.workflow_info_on_extra = False
20+
#workflow.logger.workflow_info_on_extra = False
2121

2222
@workflow.run
2323
async def run(self, input: TranslationWorkflowInput) -> TranslationWorkflowOutput:
@@ -44,11 +44,14 @@ async def run(self, input: TranslationWorkflowInput) -> TranslationWorkflowOutpu
4444

4545
# TODO PART D:Add a Timer that sleeps for 10 seconds
4646

47+
4748
# TODO PART A:Add a log message using the workflow logger at the debug level
4849
# stating that the Activity has been invoked. Include the term and language code.
50+
4951
goodbye_input = TranslationActivityInput(
5052
language_code=input.language_code, term="goodbye"
5153
)
54+
5255
goodbye_result = await workflow.execute_activity_method(
5356
TranslationActivities.translate_term,
5457
goodbye_input,

exercises/durable-execution/solution/workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
class TranslationWorkflow:
1818

1919
workflow.logger.workflow_info_on_message = False
20-
workflow.logger.workflow_info_on_extra = False
20+
#workflow.logger.workflow_info_on_extra = False
2121

2222
@workflow.run
2323
async def run(self, input: TranslationWorkflowInput) -> TranslationWorkflowOutput:
24-
workflow.logger.info(f"tTranslationWorkflow invoked with {input}")
24+
workflow.logger.info(f"TranslationWorkflow invoked with {input}")
2525

2626
hello_input = TranslationActivityInput(
2727
language_code=input.language_code, term="hello"

exercises/testing-code/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ test, which you'll find in the `test_activities.py` file in the `tests` director
4444
Since the test runs the Activity, which in turn calls the microservice to do
4545
the translation, you'll begin by starting that.
4646

47-
1. Run the `python -m pytest` command to execute the provided test
47+
1. Navigate to `exercises/testing-code/practice`
48+
2. Run the `python -m pytest` command to execute the provided test
4849

4950
## Part B: Add another test case for the Activity
5051

@@ -136,11 +137,12 @@ continue with the following steps.
136137
```
137138
4. Create a new async function to mock your Activity.
138139
1. Name it `translate_term_mocked_french` and decorate it with
139-
`@activity.defn(name="translate_term")`. The function should take `TranslationActivityInput`
140+
`@activity.defn(name="translate_term")`. The function's signature should
141+
match that of the activity it is mocking.
140142
2. In the body of your new mocked Activity, write an if statement that returns
141143
a new `TranslationActivityOutput` object containing `Bonjour` if the term
142144
that was passed in via the `TranslationActivityInput` was `hello`. Otherwise
143-
return a new `TranslationActivityObject` containing `Au revoir`.
145+
return a new `TranslationActivityOutput` containing `Au revoir`.
144146
3. The full mocked Activity is shown below:
145147
```python
146148
@activity.defn(name="translate_term")

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pluggy==1.5.0
1616
protobuf==5.27.0
1717
pytest==8.2.2
1818
pytest-asyncio==0.23.7
19-
temporalio==1.6.0
19+
temporalio==1.10.0
2020
types-protobuf==5.26.0.20240422
2121
typing_extensions==4.12.1
2222
Werkzeug==3.0.3

0 commit comments

Comments
 (0)