Skip to content

Commit db140b7

Browse files
authored
Documentation fixes (#3268)
1 parent d20e13f commit db140b7

File tree

5 files changed

+21
-31
lines changed

5 files changed

+21
-31
lines changed

frontend/docs/pages/v1/external-events/event-filters.mdx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,12 @@ You also can create event filters by using the `filters` clients on the SDKs:
5252
</UniversalTabs>
5353

5454
<Callout type="warning">
55-
Note the `scope` argument to the filter. When you create a filter, it must be
56-
given a `scope` which will be used by Hatchet internally to look it up. When
57-
you push events that you want filtered, you **must provide a `scope` with
58-
those events that matches the scope sent with the filter**. If you do not, the
59-
filter will not apply.
55+
Note the `scope` argument to the filter is required **both when creating a
56+
filter, and when pushing events**. If the scope on filter creation does not
57+
match the scope provided when pushing events, the filter will not apply.
6058
</Callout>
6159

62-
Then, push an event that uses the filter to determine whether or not to run. For instance, this run will be skipped, since the payload does not match the expression:
60+
Then, push an event that uses the filter to determine whether to run. For instance, this run will be skipped, since the payload does not match the expression:
6361

6462
<UniversalTabs items={["Python", "Typescript", "Go", "Ruby"]} variant="hidden">
6563
<Tabs.Tab title="Python">

frontend/docs/pages/v1/external-events/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ description: Push events and trigger tasks from external sources.
66
# External Events
77

88
Integrate external event sources to trigger and coordinate tasks.
9+
For example, you could execute any number of tasks in response to a user signup by
10+
declaring the "user:signup" event type as triggers to each of the tasks, and then pushing an event when a user signs up.
911

1012
- [Pushing Events](/v1/external-events/pushing-events) — Send events to Hatchet
1113
- [Event Trigger](/v1/external-events/run-on-event) — Trigger tasks on events

frontend/docs/pages/v1/inter-service-triggering.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { snippets } from "@/lib/generated/snippets";
55

66
## Invoking Tasks From Other Services
77

8-
While Hatchet recommends importing your workflows and standalone tasks directly to use for triggering runs, this only works in a monorepo or similar setups where you have access to those objects. However, it's common to have a polyrepo, have code written in multiple languages, or otherwise not be able to import your workflows and standalone tasks directly. Hatchet provides first-class, type-safe support for handling these cases as well, with only minor code duplication, to allow you to trigger your tasks from anywhere in a type-safe way.
8+
While Hatchet recommends importing your workflows and standalone tasks directly to use for triggering runs, this only works in a monorepo or similar setups where you have access to those objects. However, it's common to have a polyrepo, have code written in multiple languages, or otherwise not be able to import your workflows and standalone tasks directly.
9+
Hatchet provides stub tasks for these cases, allowing you to trigger your tasks from anywhere in a type-safe way with only minor code duplication.
910

1011
### Creating a "Stub" Task on your External Service (Recommended)
1112

@@ -30,7 +31,7 @@ Consider a task with an implementation like this:
3031

3132
<Snippet src={snippets.python.stubs.implementation.all} />
3233

33-
To trigger this task from a separate service, for instance, in a microservices architecture, where the code is not shared, start by defining models that match the input and output types of the task defined above.
34+
To trigger this task from a separate service where the code is not shared, start by defining models that match the input and output types of the task defined above.
3435

3536
<Snippet src={snippets.python.stubs.stub_trigger.define_models} />
3637

frontend/docs/pages/v1/retry-policies.mdx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ To enable retries for a task, simply add the `retries` property to the task obje
4444

4545
You can add the `retries` property to any task, and Hatchet will handle the retry logic automatically.
4646

47-
It's important to note that task-level retries are not suitable for all types of failures. For example, if a task fails due to a programming error or an invalid configuration, retrying the task will likely not resolve the issue. In these cases, you should fix the underlying problem in your code or configuration rather than relying on retries.
47+
It's important to note that task-level retries are not suitable for all types of failures.
48+
For example, if a task fails due to a programming error or an invalid configuration, retrying the task will likely not resolve the issue.
49+
In these cases, you should fix the underlying problem in your code or configuration rather than relying on retries. See [Bypassing retry logic](#bypassing-retry-logic).
4850

4951
Additionally, if a task interacts with external services or databases, you should ensure that the operation is idempotent (i.e. can be safely repeated without changing the result) before enabling retries. Otherwise, retrying the task could lead to unintended side effects or inconsistencies in your data.
5052

5153
## Accessing the Retry Count in a Running Task
5254

53-
If you need to access the current retry count within a task, you can use the `retryCount` method available in the task context:
55+
You can access the current retry count on the task's context object:
5456

55-
<UniversalTabs items={["Python", "Typescript", "Go", "Ruby"]} variant="hidden">
57+
<UniversalTabs items={["Python", "Typescript", "Go", "Ruby"]}>
5658
<Tabs.Tab>
5759
<Snippet src={snippets.python.retries.worker.retries_with_count} />
5860
</Tabs.Tab>
@@ -214,4 +216,4 @@ Python SDK client retries use exponential backoff with jitter. Fine-grained back
214216

215217
Hatchet's task-level retry feature is a simple and effective way to handle transient failures in your tasks, improving the reliability and resilience of your tasks. By specifying the number of retries for each task, you can ensure that your tasks can recover from temporary issues without requiring complex error handling logic.
216218

217-
Remember to use retries judiciously and only for tasks that are idempotent and can safely be repeated. For more advanced retry strategies, such as exponential backoff or circuit breaking, stay tuned for future updates to Hatchet's retry capabilities.
219+
Remember to use retries judiciously and only for tasks that are idempotent. For more advanced retry strategies, such as exponential backoff or circuit breaking, stay tuned for future updates to Hatchet's retry capabilities.

frontend/docs/pages/v1/timeouts.mdx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ In these tasks, both timeouts are specified, meaning:
6161
2. If the task does not complete before the `execution_timeout` is reached (after starting), it will be cancelled.
6262

6363
<Callout type="warning">
64-
A timed out step does not guarantee that the step will be stopped immediately.
65-
The step will be stopped as soon as the worker is able to stop the step. See
64+
A timed out task does not guarantee that the task will be stopped immediately.
65+
The task will be stopped as soon as the worker is able to stop the task. See
6666
[cancellation](./cancellation.mdx) for more information.
6767
</Callout>
6868

6969
## Refreshing Timeouts
7070

71-
In some cases, you may need to extend the timeout for a step while it is running. This can be done using the `refreshTimeout` method provided by the step context (`ctx`).
71+
In some cases, you may need to extend the timeout for a task while it is running. This can be done by using the task context.
7272

7373
For example:
7474

75-
<UniversalTabs items={['Python', 'Typescript', 'Go', "Ruby"]} variant="hidden">
75+
<UniversalTabs items={['Python', 'Typescript', 'Go', "Ruby"]}>
7676
<Tabs.Tab>
7777
<Snippet src={snippets.python.timeout.worker.refresh_timeout} />
7878

@@ -88,19 +88,6 @@ For example:
8888
</Tabs.Tab>
8989
</UniversalTabs>
9090

91-
In this example, the step initially would exceed its execution timeout. But before it does, we call the `refreshTimeout` method, which extends the timeout and allows it to complete. Importantly, refreshing a timeout is an additive operation - the new timeout is added to the existing timeout. So for instance, if the task originally had a timeout of `30s` and we call `refreshTimeout("15s")`, the new timeout will be `45s`.
92-
93-
The `refreshTimeout` function can be called multiple times within a step to further extend the timeout as needed.
94-
95-
## Use Cases
96-
97-
Timeouts are useful in a variety of scenarios:
98-
99-
- Ensuring tasks don't run indefinitely and consume unnecessary resources
100-
- Failing tasks early if a critical step takes too long
101-
- Keeping tasks responsive by ensuring individual steps complete in a timely manner
102-
- Preventing infinite loops or hung processes from blocking the entire system
103-
104-
For example, if you have a task that makes an external API call, you may want to set a timeout to ensure the task fails quickly if the API is unresponsive, rather than waiting indefinitely.
91+
In this example, the task initially would exceed its execution timeout. But before it does, we call the `refreshTimeout` method, which extends the timeout and allows it to complete. Importantly, refreshing a timeout is an additive operation - the new timeout is added to the existing timeout. So for instance, if the task originally had a timeout of `30s` and we call `refreshTimeout("15s")`, the new timeout will be `45s`.
10592

106-
By carefully considering timeouts for your tasks and steps, you can build more resilient and responsive systems with Hatchet.
93+
The task timeout can be refreshed multiple times within a task to further extend the timeout as needed.

0 commit comments

Comments
 (0)