Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def lint(s: nox.Session) -> None:
@nox.session
def docs(s: nox.Session) -> None:
install_deps(s, ["docs"])
_ = s.run("mkdocs", "build")
_ = s.run("zensical", "build")
28 changes: 14 additions & 14 deletions src/duron/_core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ async def start(
) -> Task[_T]:
"""Start a new durable function within the session.

Raises:
RuntimeError: If a durable function is already running or the session is \
not started.

Args:
fn: The durable function to run.
*args: Positional arguments to pass to the durable function.
Expand All @@ -160,6 +156,10 @@ async def start(
Returns:
A `Task` representing the running durable function.

Raises:
RuntimeError: If a durable function is already running or the session is \
not started.

"""
if self._current_task is not None:
msg = "A durable function is already running"
Expand Down Expand Up @@ -203,16 +203,16 @@ def init() -> InitParams:
async def resume(self, fn: DurableFn[_P, _T]) -> Task[_T]:
"""Resume a durable function within the session.

Raises:
RuntimeError: If a durable function is already running or the session is \
not started.

Args:
fn: The durable function to run.

Returns:
A `Task` representing the running durable function.

Raises:
RuntimeError: If a durable function is already running or the session is \
not started.

"""
if self._current_task is not None:
msg = "A durable function is already running"
Expand All @@ -236,13 +236,13 @@ def init() -> InitParams:
async def verify(self, fn: DurableFn[_P, _T]) -> None:
"""Verify if the durable function has completed within the session.

Args:
fn: The durable function to verify.

Raises:
RuntimeError: If a durable function is already running or the session is \
not started.

Args:
fn: The durable function to verify.

"""
if self._current_task is not None:
msg = "A durable function is already running"
Expand Down Expand Up @@ -781,15 +781,15 @@ async def complete_future(
) -> None:
"""Complete a future with the given result or exception.

Raises:
ValueError: If the future with the given ID does not exist.

Args:
future_id: The ID created by [`create_future`][duron.Context.create_future].
result: The result to complete the future with.
result_type: The type of the result.
exception: The exception to complete the future with.

Raises:
ValueError: If the future with the given ID does not exist.

"""
if not self._task_manager.has_future(future_id):
msg = "Promise not found"
Expand Down
12 changes: 6 additions & 6 deletions src/duron/_core/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def __init__(self, stream_id: str, loop: EventLoop) -> None:
async def send(self, value: _T, /) -> None:
"""Send a value to the stream.

Raises:
RuntimeError: If the stream is already closed.

Args:
value: The value to send to stream consumers.

Raises:
RuntimeError: If the stream is already closed.

"""
if self._closed:
msg = "Cannot send to a closed stream"
Expand All @@ -92,12 +92,12 @@ async def send(self, value: _T, /) -> None:
async def close(self, exception: Exception | None = None, /) -> None:
"""Close the stream, optionally with an error.

Raises:
RuntimeError: If the stream is already closed.

Args:
exception: Optional exception to signal an error condition to consumers.

Raises:
RuntimeError: If the stream is already closed.

"""
if self._closed:
msg = "Cannot send to a closed stream"
Expand Down
Loading