|
17 | 17 | RegisteredFunctionJobCollection, |
18 | 18 | ) |
19 | 19 | from models_library.functions import ( |
| 20 | + FunctionJobStatus, |
| 21 | + FunctionOutputs, |
20 | 22 | FunctionUserAccessRights, |
21 | 23 | FunctionUserApiAccessRights, |
22 | 24 | ) |
@@ -300,6 +302,82 @@ async def get_function_job( |
300 | 302 | return TypeAdapter(RegisteredFunctionJob).validate_python(result) |
301 | 303 |
|
302 | 304 |
|
| 305 | +@log_decorator(_logger, level=logging.DEBUG) |
| 306 | +async def get_function_job_status( |
| 307 | + rabbitmq_rpc_client: RabbitMQRPCClient, |
| 308 | + *, |
| 309 | + user_id: UserID, |
| 310 | + function_job_id: FunctionJobID, |
| 311 | + product_name: ProductName, |
| 312 | +) -> FunctionJobStatus: |
| 313 | + result = await rabbitmq_rpc_client.request( |
| 314 | + WEBSERVER_RPC_NAMESPACE, |
| 315 | + TypeAdapter(RPCMethodName).validate_python("get_function_job_status"), |
| 316 | + function_job_id=function_job_id, |
| 317 | + user_id=user_id, |
| 318 | + product_name=product_name, |
| 319 | + ) |
| 320 | + return TypeAdapter(FunctionJobStatus).validate_python(result) |
| 321 | + |
| 322 | + |
| 323 | +@log_decorator(_logger, level=logging.DEBUG) |
| 324 | +async def get_function_job_outputs( |
| 325 | + rabbitmq_rpc_client: RabbitMQRPCClient, |
| 326 | + *, |
| 327 | + user_id: UserID, |
| 328 | + function_job_id: FunctionJobID, |
| 329 | + product_name: ProductName, |
| 330 | +) -> FunctionOutputs: |
| 331 | + result = await rabbitmq_rpc_client.request( |
| 332 | + WEBSERVER_RPC_NAMESPACE, |
| 333 | + TypeAdapter(RPCMethodName).validate_python("get_function_job_outputs"), |
| 334 | + function_job_id=function_job_id, |
| 335 | + user_id=user_id, |
| 336 | + product_name=product_name, |
| 337 | + ) |
| 338 | + return TypeAdapter(FunctionOutputs).validate_python(result) |
| 339 | + |
| 340 | + |
| 341 | +@log_decorator(_logger, level=logging.DEBUG) |
| 342 | +async def update_function_job_status( |
| 343 | + rabbitmq_rpc_client: RabbitMQRPCClient, |
| 344 | + *, |
| 345 | + user_id: UserID, |
| 346 | + product_name: ProductName, |
| 347 | + function_job_id: FunctionJobID, |
| 348 | + job_status: FunctionJobStatus, |
| 349 | +) -> FunctionJobStatus: |
| 350 | + result = await rabbitmq_rpc_client.request( |
| 351 | + WEBSERVER_RPC_NAMESPACE, |
| 352 | + TypeAdapter(RPCMethodName).validate_python("update_function_job_status"), |
| 353 | + function_job_id=function_job_id, |
| 354 | + job_status=job_status, |
| 355 | + user_id=user_id, |
| 356 | + product_name=product_name, |
| 357 | + ) |
| 358 | + return TypeAdapter(FunctionJobStatus).validate_python(result) |
| 359 | + |
| 360 | + |
| 361 | +@log_decorator(_logger, level=logging.DEBUG) |
| 362 | +async def update_function_job_outputs( |
| 363 | + rabbitmq_rpc_client: RabbitMQRPCClient, |
| 364 | + *, |
| 365 | + user_id: UserID, |
| 366 | + product_name: ProductName, |
| 367 | + function_job_id: FunctionJobID, |
| 368 | + outputs: FunctionOutputs, |
| 369 | +) -> FunctionOutputs: |
| 370 | + result = await rabbitmq_rpc_client.request( |
| 371 | + WEBSERVER_RPC_NAMESPACE, |
| 372 | + TypeAdapter(RPCMethodName).validate_python("update_function_job_outputs"), |
| 373 | + function_job_id=function_job_id, |
| 374 | + outputs=outputs, |
| 375 | + user_id=user_id, |
| 376 | + product_name=product_name, |
| 377 | + ) |
| 378 | + return TypeAdapter(FunctionOutputs).validate_python(result) |
| 379 | + |
| 380 | + |
303 | 381 | @log_decorator(_logger, level=logging.DEBUG) |
304 | 382 | async def delete_function_job( |
305 | 383 | rabbitmq_rpc_client: RabbitMQRPCClient, |
|
0 commit comments