You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: frontend/docs/pages/v1/external-events/event-filters.mdx
+4-6Lines changed: 4 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,14 +52,12 @@ You also can create event filters by using the `filters` clients on the SDKs:
52
52
</UniversalTabs>
53
53
54
54
<Callouttype="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.
60
58
</Callout>
61
59
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:
Copy file name to clipboardExpand all lines: frontend/docs/pages/v1/inter-service-triggering.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,8 @@ import { snippets } from "@/lib/generated/snippets";
5
5
6
6
## Invoking Tasks From Other Services
7
7
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.
9
10
10
11
### Creating a "Stub" Task on your External Service (Recommended)
11
12
@@ -30,7 +31,7 @@ Consider a task with an implementation like this:
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.
Copy file name to clipboardExpand all lines: frontend/docs/pages/v1/retry-policies.mdx
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,15 +44,17 @@ To enable retries for a task, simply add the `retries` property to the task obje
44
44
45
45
You can add the `retries` property to any task, and Hatchet will handle the retry logic automatically.
46
46
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).
48
50
49
51
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.
50
52
51
53
## Accessing the Retry Count in a Running Task
52
54
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:
@@ -214,4 +216,4 @@ Python SDK client retries use exponential backoff with jitter. Fine-grained back
214
216
215
217
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.
216
218
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.
Copy file name to clipboardExpand all lines: frontend/docs/pages/v1/timeouts.mdx
+6-19Lines changed: 6 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,18 +61,18 @@ In these tasks, both timeouts are specified, meaning:
61
61
2. If the task does not complete before the `execution_timeout` is reached (after starting), it will be cancelled.
62
62
63
63
<Callouttype="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
66
66
[cancellation](./cancellation.mdx) for more information.
67
67
</Callout>
68
68
69
69
## Refreshing Timeouts
70
70
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.
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`.
105
92
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