2828 RegisteredFunctionJobWithStatus ,
2929)
3030from models_library .products import ProductName
31- from models_library .rabbitmq_basic_types import RPCMethodName
3231from models_library .rest_ordering import OrderBy
32+
33+ from models_library .rabbitmq_basic_types import RPCMethodName , RPCNamespace
3334from models_library .rest_pagination import PageMetaInfoLimitOffset
3435from models_library .users import UserID
3536from pydantic import TypeAdapter
4243
4344@log_decorator (_logger , level = logging .DEBUG )
4445async def register_function (
45- rabbitmq_rpc_client : RabbitMQRPCClient ,
46+ rpc_client : RabbitMQRPCClient ,
47+ rpc_namespace : RPCNamespace ,
4648 * ,
4749 user_id : UserID ,
4850 product_name : ProductName ,
4951 function : Function ,
5052) -> RegisteredFunction :
51- result = await rabbitmq_rpc_client .request (
52- WEBSERVER_RPC_NAMESPACE ,
53+ result = await rpc_client .request (
54+ rpc_namespace ,
5355 TypeAdapter (RPCMethodName ).validate_python ("register_function" ),
5456 function = function ,
5557 user_id = user_id ,
5658 product_name = product_name ,
5759 )
58- return TypeAdapter (RegisteredFunction ).validate_python (
59- result
60- ) # Validates the result as a RegisteredFunction
60+ return TypeAdapter (RegisteredFunction ).validate_python (result )
6161
6262
6363@log_decorator (_logger , level = logging .DEBUG )
6464async def get_function (
65- rabbitmq_rpc_client : RabbitMQRPCClient ,
65+ rpc_client : RabbitMQRPCClient ,
66+ rpc_namespace : RPCNamespace ,
6667 * ,
6768 user_id : UserID ,
6869 product_name : ProductName ,
6970 function_id : FunctionID ,
7071) -> RegisteredFunction :
71- result = await rabbitmq_rpc_client .request (
72- WEBSERVER_RPC_NAMESPACE ,
72+ result = await rpc_client .request (
73+ rpc_namespace ,
7374 TypeAdapter (RPCMethodName ).validate_python ("get_function" ),
7475 function_id = function_id ,
7576 user_id = user_id ,
@@ -80,14 +81,15 @@ async def get_function(
8081
8182@log_decorator (_logger , level = logging .DEBUG )
8283async def get_function_input_schema (
83- rabbitmq_rpc_client : RabbitMQRPCClient ,
84+ rpc_client : RabbitMQRPCClient ,
85+ rpc_namespace : RPCNamespace ,
8486 * ,
8587 function_id : FunctionID ,
8688 user_id : UserID ,
8789 product_name : ProductName ,
8890) -> FunctionInputSchema :
89- result = await rabbitmq_rpc_client .request (
90- WEBSERVER_RPC_NAMESPACE ,
91+ result = await rpc_client .request (
92+ rpc_namespace ,
9193 TypeAdapter (RPCMethodName ).validate_python ("get_function_input_schema" ),
9294 function_id = function_id ,
9395 user_id = user_id ,
@@ -98,14 +100,15 @@ async def get_function_input_schema(
98100
99101@log_decorator (_logger , level = logging .DEBUG )
100102async def get_function_output_schema (
101- rabbitmq_rpc_client : RabbitMQRPCClient ,
103+ rpc_client : RabbitMQRPCClient ,
104+ rpc_namespace : RPCNamespace ,
102105 * ,
103106 function_id : FunctionID ,
104107 user_id : UserID ,
105108 product_name : ProductName ,
106109) -> FunctionOutputSchema :
107- result = await rabbitmq_rpc_client .request (
108- WEBSERVER_RPC_NAMESPACE ,
110+ result = await rpc_client .request (
111+ rpc_namespace ,
109112 TypeAdapter (RPCMethodName ).validate_python ("get_function_output_schema" ),
110113 function_id = function_id ,
111114 user_id = user_id ,
@@ -116,14 +119,15 @@ async def get_function_output_schema(
116119
117120@log_decorator (_logger , level = logging .DEBUG )
118121async def delete_function (
119- rabbitmq_rpc_client : RabbitMQRPCClient ,
122+ rpc_client : RabbitMQRPCClient ,
123+ rpc_namespace : RPCNamespace ,
120124 * ,
121125 function_id : FunctionID ,
122126 user_id : UserID ,
123127 product_name : ProductName ,
124128) -> None :
125- result = await rabbitmq_rpc_client .request (
126- WEBSERVER_RPC_NAMESPACE ,
129+ result = await rpc_client .request (
130+ rpc_namespace ,
127131 TypeAdapter (RPCMethodName ).validate_python ("delete_function" ),
128132 function_id = function_id ,
129133 user_id = user_id ,
@@ -135,7 +139,7 @@ async def delete_function(
135139
136140@log_decorator (_logger , level = logging .DEBUG )
137141async def list_functions (
138- rabbitmq_rpc_client : RabbitMQRPCClient ,
142+ rpc_client : RabbitMQRPCClient ,
139143 * ,
140144 user_id : UserID ,
141145 product_name : ProductName ,
@@ -147,7 +151,7 @@ async def list_functions(
147151 search_by_multi_columns : str | None = None ,
148152) -> tuple [list [RegisteredFunction ], PageMetaInfoLimitOffset ]:
149153 result : tuple [list [RegisteredFunction ], PageMetaInfoLimitOffset ] = (
150- await rabbitmq_rpc_client .request (
154+ await rpc_client .request (
151155 WEBSERVER_RPC_NAMESPACE ,
152156 TypeAdapter (RPCMethodName ).validate_python ("list_functions" ),
153157 pagination_offset = pagination_offset ,
@@ -167,7 +171,7 @@ async def list_functions(
167171
168172@log_decorator (_logger , level = logging .DEBUG )
169173async def list_function_jobs (
170- rabbitmq_rpc_client : RabbitMQRPCClient ,
174+ rpc_client : RabbitMQRPCClient ,
171175 * ,
172176 user_id : UserID ,
173177 product_name : ProductName ,
@@ -178,7 +182,7 @@ async def list_function_jobs(
178182 filter_by_function_job_collection_id : FunctionJobCollectionID | None = None ,
179183) -> tuple [list [RegisteredFunctionJob ], PageMetaInfoLimitOffset ]:
180184 result : tuple [list [RegisteredFunctionJob ], PageMetaInfoLimitOffset ] = (
181- await rabbitmq_rpc_client .request (
185+ await rpc_client .request (
182186 WEBSERVER_RPC_NAMESPACE ,
183187 TypeAdapter (RPCMethodName ).validate_python ("list_function_jobs" ),
184188 user_id = user_id ,
@@ -231,15 +235,15 @@ async def list_function_jobs_with_status(
231235
232236@log_decorator (_logger , level = logging .DEBUG )
233237async def list_function_job_collections (
234- rabbitmq_rpc_client : RabbitMQRPCClient ,
238+ rpc_client : RabbitMQRPCClient ,
235239 * ,
236240 user_id : UserID ,
237241 product_name : ProductName ,
238242 pagination_limit : int ,
239243 pagination_offset : int ,
240244 filters : FunctionJobCollectionsListFilters | None = None ,
241245) -> tuple [list [RegisteredFunctionJobCollection ], PageMetaInfoLimitOffset ]:
242- result = await rabbitmq_rpc_client .request (
246+ result = await rpc_client .request (
243247 WEBSERVER_RPC_NAMESPACE ,
244248 TypeAdapter (RPCMethodName ).validate_python ("list_function_job_collections" ),
245249 pagination_offset = pagination_offset ,
@@ -255,14 +259,14 @@ async def list_function_job_collections(
255259
256260@log_decorator (_logger , level = logging .DEBUG )
257261async def update_function_title (
258- rabbitmq_rpc_client : RabbitMQRPCClient ,
262+ rpc_client : RabbitMQRPCClient ,
259263 * ,
260264 user_id : UserID ,
261265 product_name : ProductName ,
262266 function_id : FunctionID ,
263267 title : str ,
264268) -> RegisteredFunction :
265- result = await rabbitmq_rpc_client .request (
269+ result = await rpc_client .request (
266270 WEBSERVER_RPC_NAMESPACE ,
267271 TypeAdapter (RPCMethodName ).validate_python ("update_function_title" ),
268272 function_id = function_id ,
@@ -275,14 +279,14 @@ async def update_function_title(
275279
276280@log_decorator (_logger , level = logging .DEBUG )
277281async def update_function_description (
278- rabbitmq_rpc_client : RabbitMQRPCClient ,
282+ rpc_client : RabbitMQRPCClient ,
279283 * ,
280284 user_id : UserID ,
281285 product_name : ProductName ,
282286 function_id : FunctionID ,
283287 description : str ,
284288) -> RegisteredFunction :
285- result = await rabbitmq_rpc_client .request (
289+ result = await rpc_client .request (
286290 WEBSERVER_RPC_NAMESPACE ,
287291 TypeAdapter (RPCMethodName ).validate_python ("update_function_description" ),
288292 function_id = function_id ,
@@ -295,14 +299,14 @@ async def update_function_description(
295299
296300@log_decorator (_logger , level = logging .DEBUG )
297301async def run_function (
298- rabbitmq_rpc_client : RabbitMQRPCClient ,
302+ rpc_client : RabbitMQRPCClient ,
299303 * ,
300304 function_id : FunctionID ,
301305 inputs : FunctionInputs ,
302306 user_id : UserID ,
303307 product_name : ProductName ,
304308) -> RegisteredFunctionJob :
305- result = await rabbitmq_rpc_client .request (
309+ result = await rpc_client .request (
306310 WEBSERVER_RPC_NAMESPACE ,
307311 TypeAdapter (RPCMethodName ).validate_python ("run_function" ),
308312 function_id = function_id ,
@@ -317,13 +321,13 @@ async def run_function(
317321
318322@log_decorator (_logger , level = logging .DEBUG )
319323async def register_function_job (
320- rabbitmq_rpc_client : RabbitMQRPCClient ,
324+ rpc_client : RabbitMQRPCClient ,
321325 * ,
322326 user_id : UserID ,
323327 product_name : ProductName ,
324328 function_job : FunctionJob ,
325329) -> RegisteredFunctionJob :
326- result = await rabbitmq_rpc_client .request (
330+ result = await rpc_client .request (
327331 WEBSERVER_RPC_NAMESPACE ,
328332 TypeAdapter (RPCMethodName ).validate_python ("register_function_job" ),
329333 function_job = function_job ,
@@ -359,13 +363,13 @@ async def patch_registered_function_job(
359363
360364@log_decorator (_logger , level = logging .DEBUG )
361365async def get_function_job (
362- rabbitmq_rpc_client : RabbitMQRPCClient ,
366+ rpc_client : RabbitMQRPCClient ,
363367 * ,
364368 user_id : UserID ,
365369 function_job_id : FunctionJobID ,
366370 product_name : ProductName ,
367371) -> RegisteredFunctionJob :
368- result = await rabbitmq_rpc_client .request (
372+ result = await rpc_client .request (
369373 WEBSERVER_RPC_NAMESPACE ,
370374 TypeAdapter (RPCMethodName ).validate_python ("get_function_job" ),
371375 function_job_id = function_job_id ,
@@ -458,13 +462,13 @@ async def update_function_job_outputs(
458462
459463@log_decorator (_logger , level = logging .DEBUG )
460464async def delete_function_job (
461- rabbitmq_rpc_client : RabbitMQRPCClient ,
465+ rpc_client : RabbitMQRPCClient ,
462466 * ,
463467 user_id : UserID ,
464468 product_name : ProductName ,
465469 function_job_id : FunctionJobID ,
466470) -> None :
467- result : None = await rabbitmq_rpc_client .request (
471+ result : None = await rpc_client .request (
468472 WEBSERVER_RPC_NAMESPACE ,
469473 TypeAdapter (RPCMethodName ).validate_python ("delete_function_job" ),
470474 function_job_id = function_job_id ,
@@ -476,14 +480,14 @@ async def delete_function_job(
476480
477481@log_decorator (_logger , level = logging .DEBUG )
478482async def find_cached_function_jobs (
479- rabbitmq_rpc_client : RabbitMQRPCClient ,
483+ rpc_client : RabbitMQRPCClient ,
480484 * ,
481485 user_id : UserID ,
482486 product_name : ProductName ,
483487 function_id : FunctionID ,
484488 inputs : FunctionInputs ,
485489) -> list [RegisteredFunctionJob ] | None :
486- result = await rabbitmq_rpc_client .request (
490+ result = await rpc_client .request (
487491 WEBSERVER_RPC_NAMESPACE ,
488492 TypeAdapter (RPCMethodName ).validate_python ("find_cached_function_jobs" ),
489493 function_id = function_id ,
@@ -498,13 +502,13 @@ async def find_cached_function_jobs(
498502
499503@log_decorator (_logger , level = logging .DEBUG )
500504async def register_function_job_collection (
501- rabbitmq_rpc_client : RabbitMQRPCClient ,
505+ rpc_client : RabbitMQRPCClient ,
502506 * ,
503507 user_id : UserID ,
504508 product_name : ProductName ,
505509 function_job_collection : FunctionJobCollection ,
506510) -> RegisteredFunctionJobCollection :
507- result = await rabbitmq_rpc_client .request (
511+ result = await rpc_client .request (
508512 WEBSERVER_RPC_NAMESPACE ,
509513 TypeAdapter (RPCMethodName ).validate_python ("register_function_job_collection" ),
510514 function_job_collection = function_job_collection ,
@@ -516,13 +520,13 @@ async def register_function_job_collection(
516520
517521@log_decorator (_logger , level = logging .DEBUG )
518522async def get_function_job_collection (
519- rabbitmq_rpc_client : RabbitMQRPCClient ,
523+ rpc_client : RabbitMQRPCClient ,
520524 * ,
521525 user_id : UserID ,
522526 function_job_collection_id : FunctionJobCollectionID ,
523527 product_name : ProductName ,
524528) -> RegisteredFunctionJobCollection :
525- result = await rabbitmq_rpc_client .request (
529+ result = await rpc_client .request (
526530 WEBSERVER_RPC_NAMESPACE ,
527531 TypeAdapter (RPCMethodName ).validate_python ("get_function_job_collection" ),
528532 function_job_collection_id = function_job_collection_id ,
@@ -534,13 +538,13 @@ async def get_function_job_collection(
534538
535539@log_decorator (_logger , level = logging .DEBUG )
536540async def delete_function_job_collection (
537- rabbitmq_rpc_client : RabbitMQRPCClient ,
541+ rpc_client : RabbitMQRPCClient ,
538542 * ,
539543 user_id : UserID ,
540544 product_name : ProductName ,
541545 function_job_collection_id : FunctionJobCollectionID ,
542546) -> None :
543- result = await rabbitmq_rpc_client .request (
547+ result = await rpc_client .request (
544548 WEBSERVER_RPC_NAMESPACE ,
545549 TypeAdapter (RPCMethodName ).validate_python ("delete_function_job_collection" ),
546550 function_job_collection_id = function_job_collection_id ,
0 commit comments