Skip to content

Commit 20f3e65

Browse files
author
Andrei Neagu
committed
docstring updates
1 parent 21098bd commit 20f3e65

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

packages/service-library/src/servicelib/resilent_long_running/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,5 +284,5 @@ async def ensure_result(
284284

285285
# remove from remote executor
286286
await self._rpc_interface.remove(unique_id)
287-
# remove distributed storage (redis)
287+
# remove from distributed storage (redis)
288288
await self._store_interface.remove(unique_id)

packages/service-library/src/servicelib/resilent_long_running/_server.py

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,23 @@
66

77

88
class Server:
9-
"""
10-
Server for executing and managing long-running jobs requested by remote clients.
11-
12-
This class provides the server-side counterpart to the Client, responsible for:
13-
14-
1. Registering job handlers that can process long-running tasks
15-
2. Receiving and validating job requests via RabbitMQ
16-
3. Managing job execution lifecycle (start, status tracking, result storage)
17-
4. Providing job status updates to clients
18-
5. Handling graceful job termination during server shutdown
19-
20-
Internally, the server relies on:
21-
- RPC Interface: Manages communication and request handling via RabbitMQ
22-
- Job Interface: Custom implementation that defines how jobs are executed
23-
24-
The server workflow:
25-
1. Register job handlers during initialization
26-
2. Listen for incoming job requests on specified RabbitMQ queues
27-
3. Validate incoming job parameters
28-
4. Execute jobs in a managed context
29-
5. Track job status and store results
30-
6. Respond to client status and result queries
31-
7. Clean up resources when jobs complete or are terminated
32-
33-
This design allows the server to handle multiple concurrent job requests
34-
while maintaining job state and providing resilience against server restarts.
35-
"""
36-
379
def __init__(
3810
self,
3911
rabbit_settings: RabbitSettings,
4012
long_running_namespace: LongRunningNamespace,
4113
job_interface: BaseServerJobInterface,
4214
) -> None:
15+
"""Exposes an RPC interface on the server side to run jobs
16+
17+
Arguments:
18+
rabbit_settings -- settings to connect to RabbitMQ
19+
long_running_namespace -- unique namespace for the long-running jobs (allows to regisrter multiple servicer for different pourposes)
20+
job_interface -- custom interface for hanlding the execition of the jobs
21+
"""
4322
self.rpc_interface = ServerRPCInterface(
4423
rabbit_settings, long_running_namespace, job_interface
4524
)
4625

47-
# TODO: register jobs! and then use the interface to run them!!!
48-
4926
async def setup(self) -> None:
5027
await self.rpc_interface.setup()
5128

0 commit comments

Comments
 (0)