-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add SDK parity 1 — nav, reference pages, Java reference #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
94c54f3
docs: link shared keda + prometheus in Java nav
pratyush618 2e0a43f
docs: make architecture cards + mesh doc SDK-neutral
pratyush618 bd1cfcc
docs: SDK-gate the queue comparison page
pratyush618 bfc6ed8
docs: flag Python-syntax samples in changelog
pratyush618 fb7d16e
docs: add Python serializers + errors API reference
pratyush618 c39b5c4
docs: add Node testing API reference
pratyush618 a2a21e9
docs: document Java task-log streaming in reference
pratyush618 8fe88ab
docs: document Java circuit breakers in reference
pratyush618 6f24706
docs: add Java job-dependencies guide section
pratyush618 308fc71
docs: clarify Java depends_on completion semantics
pratyush618 02b0755
docs: fix ResourceNotFoundError example message
pratyush618 383cb8d
docs: separate broker from backend in comparison
pratyush618 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "title": "Integrations", | ||
| "pages": ["index", "spring", "micrometer", "sentry"] | ||
| "pages": ["index", "spring", "micrometer", "prometheus", "sentry"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| { "title": "Operations", "pages": ["backends", "inspection", "dashboard", "sso", "mesh", "autoscaling", "cli", "testing", "security", "troubleshooting", "deployment", "graalvm"] } | ||
| { "title": "Operations", "pages": ["backends", "inspection", "dashboard", "sso", "mesh", "autoscaling", "keda", "cli", "testing", "security", "troubleshooting", "deployment", "graalvm"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| { "title": "API Reference", "root": true, "pages": ["index", "queue", "task", "worker", "result", "context", "serializers", "workflows", "errors", "cli"] } | ||
| { "title": "API Reference", "root": true, "pages": ["index", "queue", "task", "worker", "result", "context", "serializers", "workflows", "testing", "errors", "cli"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: Testing | ||
| description: "mockResource — swap a real dependency for a stub in tests." | ||
| --- | ||
|
|
||
| ```ts | ||
| import { mockResource } from "@byteveda/taskito"; | ||
| import type { MockResource } from "@byteveda/taskito"; | ||
| ``` | ||
|
|
||
| The Node SDK's testing model is: run a real in-process worker against a | ||
| throwaway queue (a temp SQLite file), enqueue, and await the result — the same | ||
| API you run in production. See the [testing guide](/node/guides/operations/testing) | ||
| for the full worker-in-a-test harness. This page covers the one dedicated test | ||
| utility: `mockResource`, for swapping an injected [resource](/node/api-reference/queue/resources) | ||
| for a stub. | ||
|
|
||
| ## `mockResource` | ||
|
|
||
| ```ts | ||
| function mockResource<T>(value: T): MockResource<T>; | ||
| ``` | ||
|
|
||
| Builds a [`MockResource`](#mockresource-1) wrapping `value`. Register its | ||
| `factory` with `queue.resource(name, mock.factory)` in place of the real | ||
| factory, then assert on `mock.resolutions` to confirm the resource was built. | ||
|
|
||
| ```ts | ||
| import { mockResource } from "@byteveda/taskito"; | ||
|
|
||
| const db = mockResource({ query: async () => [{ id: 1 }] }); | ||
| queue.resource("db", db.factory); | ||
|
|
||
| // ...run the task under test... | ||
|
|
||
| expect(db.resolutions).toBe(1); // the worker built the resource exactly once | ||
| ``` | ||
|
|
||
| ## `MockResource` | ||
|
|
||
| ```ts | ||
| interface MockResource<T> { | ||
| value: T; // the value the factory returns | ||
| factory: () => T; // pass to queue.resource(name, mock.factory) | ||
| resolutions: number; // how many times the factory was invoked | ||
| } | ||
| ``` | ||
|
|
||
| `resolutions` increments each time the injected factory runs, so a test can | ||
| assert a resource was (or wasn't) constructed — useful for verifying scope | ||
| behavior, e.g. a `worker`-scoped resource builds once while a `task`-scoped one | ||
| builds per job. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| --- | ||
| title: Errors | ||
| description: "The taskito exception hierarchy — catch by specific type or by the TaskitoError base." | ||
| --- | ||
|
|
||
| Almost every exception taskito raises extends `TaskitoError`, so a single | ||
| `except` can scope them; the specific subclasses let you branch on what went | ||
| wrong. Two exceptions sit outside the tree (noted below) — a blanket | ||
| `except TaskitoError` will not catch them. | ||
|
|
||
| ```python | ||
| from taskito import TaskitoError, ResourceNotFoundError | ||
|
|
||
| try: | ||
| result = job.result(timeout=5) | ||
| except ResourceNotFoundError as exc: | ||
| # the message names the missing resource, e.g. "Resource 'db' is not registered" | ||
| print(exc) | ||
| except TaskitoError as exc: | ||
| report(exc) | ||
| ``` | ||
|
pratyush618 marked this conversation as resolved.
|
||
|
|
||
| ## Hierarchy | ||
|
|
||
| | Class | Extends | Raised when | | ||
| |---|---|---| | ||
| | `TaskitoError` | `Exception` | Base — never raised directly. | | ||
| | `TaskTimeoutError` | `TaskitoError` | A task exceeds its hard timeout. | | ||
| | `SoftTimeoutError` | `TaskitoError` | A task exceeds its soft timeout (checked cooperatively via the context). | | ||
| | `TaskCancelledError` | `TaskitoError` | A running task detects it has been cancelled. | | ||
| | `TaskFailedError` | `TaskitoError` | Awaiting a job that failed or dead-lettered. Carries `errtype`, `traceback`, `job_id`, `raw_error`. | | ||
| | `MaxRetriesExceededError` | `TaskitoError` | A task exhausts all retry attempts. Same failure details as `TaskFailedError`. | | ||
| | `SerializationError` | `TaskitoError` | Serialization / deserialization or payload-integrity failure (e.g. a bad `SignedSerializer` signature). | | ||
| | `CryptoError` | `SerializationError` | A [payload codec](/python/api-reference/serializers) (`HmacCodec`, `AesGcmCodec`) fails to decrypt or verify. | | ||
| | `InterceptionError` | `SerializationError` | An [argument interceptor](/python/guides/resources/proxies) rejects or misbehaves. | | ||
| | `CircuitBreakerOpenError` | `TaskitoError` | A task's circuit breaker is open. | | ||
| | `RateLimitExceededError` | `TaskitoError` | A task's rate limit is exceeded. | | ||
| | `JobNotFoundError` | `TaskitoError`, `KeyError` | A job ID isn't found in storage. | | ||
| | `QueueError` | `TaskitoError` | A queue-level operational error. | | ||
| | `NotesValidationError` | `TaskitoError`, `ValueError` | A `notes` dict breaks the contract (>15 fields, >4 KiB, …). | | ||
| | `PredicateRejectedError` | `TaskitoError` | An enqueue-time [predicate](/python/guides/core/predicates) cancelled the submission. Carries `task_name`, `reason`. | | ||
| | `BatchPartialFailureError` | `TaskFailedError` | A batch task where some items failed. | | ||
| | `ResourceError` | `TaskitoError` | Base for resource dependency-injection errors. | | ||
| | `ResourceInitError` | `ResourceError` | A resource factory fails during initialization. | | ||
| | `ResourceUnavailableError` | `ResourceError` | A resource is permanently unhealthy and can't be resolved. | | ||
| | `CircularDependencyError` | `ResourceError` | Resource dependencies form a cycle. | | ||
| | `ResourceNotFoundError` | `ResourceError`, `KeyError` | Resolving a resource name that was never registered. | | ||
| | `ProxyReconstructionError` | `ResourceError` | A proxy handler fails to reconstruct an object from its recipe. | | ||
| | `ProxyCleanupError` | `ResourceError` | A proxy handler fails during cleanup. | | ||
|
|
||
| ## Outside the `TaskitoError` tree | ||
|
|
||
| | Class | Extends | Import from | Raised when | | ||
| |---|---|---|---| | ||
| | `LockNotAcquiredError` | `Exception` | `taskito.locks` | `queue.lock(...)` can't acquire a held lock. | | ||
| | `BatchResultTypeError` | `TypeError` | `taskito` | A batch result is read as the wrong type. | | ||
|
|
||
| The `KeyError` / `ValueError` / `TypeError` mix-ins keep existing | ||
| `except KeyError` / `except ValueError` clauses working when these are raised | ||
| inside enqueue or lookup paths. | ||
|
|
||
| See [error handling](/python/guides/reliability/error-handling) for retry / | ||
| timeout / dead-letter behavior around a failing task. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.