modelexpress-client 0.7.0

Client library for Model Express gRPC server
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from . import refit_pb2 as refit__pb2

GRPC_GENERATED_VERSION = '1.66.2'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + ' but the generated code in refit_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class RefitServiceStub(object):
    """Control-plane metadata for RL weight publication. Object-storage-backed
    versions own one global object URI; worker-sharded versions advertise
    per-worker manifests.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.CreateWeightVersion = channel.unary_unary(
                '/model_express.refit.RefitService/CreateWeightVersion',
                request_serializer=refit__pb2.CreateWeightVersionRequest.SerializeToString,
                response_deserializer=refit__pb2.CreateWeightVersionResponse.FromString,
                _registered_method=True)
        self.GetWeightVersion = channel.unary_unary(
                '/model_express.refit.RefitService/GetWeightVersion',
                request_serializer=refit__pb2.GetWeightVersionRequest.SerializeToString,
                response_deserializer=refit__pb2.GetWeightVersionResponse.FromString,
                _registered_method=True)
        self.DeleteWeightVersion = channel.unary_unary(
                '/model_express.refit.RefitService/DeleteWeightVersion',
                request_serializer=refit__pb2.DeleteWeightVersionRequest.SerializeToString,
                response_deserializer=refit__pb2.DeleteWeightVersionResponse.FromString,
                _registered_method=True)
        self.UpdateWeightVersionState = channel.unary_unary(
                '/model_express.refit.RefitService/UpdateWeightVersionState',
                request_serializer=refit__pb2.UpdateWeightVersionStateRequest.SerializeToString,
                response_deserializer=refit__pb2.UpdateWeightVersionStateResponse.FromString,
                _registered_method=True)
        self.RegisterWorker = channel.unary_unary(
                '/model_express.refit.RefitService/RegisterWorker',
                request_serializer=refit__pb2.RegisterWorkerRequest.SerializeToString,
                response_deserializer=refit__pb2.RegisterWorkerResponse.FromString,
                _registered_method=True)
        self.CreateWeightVersionShard = channel.unary_unary(
                '/model_express.refit.RefitService/CreateWeightVersionShard',
                request_serializer=refit__pb2.CreateWeightVersionShardRequest.SerializeToString,
                response_deserializer=refit__pb2.CreateWeightVersionShardResponse.FromString,
                _registered_method=True)
        self.ListWeightVersionShards = channel.unary_unary(
                '/model_express.refit.RefitService/ListWeightVersionShards',
                request_serializer=refit__pb2.ListWeightVersionShardsRequest.SerializeToString,
                response_deserializer=refit__pb2.ListWeightVersionShardsResponse.FromString,
                _registered_method=True)
        self.DeleteWeightVersionShard = channel.unary_unary(
                '/model_express.refit.RefitService/DeleteWeightVersionShard',
                request_serializer=refit__pb2.DeleteWeightVersionShardRequest.SerializeToString,
                response_deserializer=refit__pb2.DeleteWeightVersionShardResponse.FromString,
                _registered_method=True)
        self.RegisterVersionLease = channel.unary_unary(
                '/model_express.refit.RefitService/RegisterVersionLease',
                request_serializer=refit__pb2.RegisterVersionLeaseRequest.SerializeToString,
                response_deserializer=refit__pb2.RegisterVersionLeaseResponse.FromString,
                _registered_method=True)
        self.DeleteVersionLease = channel.unary_unary(
                '/model_express.refit.RefitService/DeleteVersionLease',
                request_serializer=refit__pb2.DeleteVersionLeaseRequest.SerializeToString,
                response_deserializer=refit__pb2.DeleteVersionLeaseResponse.FromString,
                _registered_method=True)


class RefitServiceServicer(object):
    """Control-plane metadata for RL weight publication. Object-storage-backed
    versions own one global object URI; worker-sharded versions advertise
    per-worker manifests.
    """

    def CreateWeightVersion(self, request, context):
        """External APIs: called by the RL framework orchestrator.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetWeightVersion(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeleteWeightVersion(self, request, context):
        """Cancel a STAGING version or retire a READY version.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UpdateWeightVersionState(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RegisterWorker(self, request, context):
        """Internal APIs: called by ModelExpress worker clients, not by the RL
        framework orchestrator.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CreateWeightVersionShard(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListWeightVersionShards(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeleteWeightVersionShard(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RegisterVersionLease(self, request, context):
        """A live lease protects the version source while a generator installs it.
        Re-registering the same lease owner renews its expiry.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeleteVersionLease(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_RefitServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'CreateWeightVersion': grpc.unary_unary_rpc_method_handler(
                    servicer.CreateWeightVersion,
                    request_deserializer=refit__pb2.CreateWeightVersionRequest.FromString,
                    response_serializer=refit__pb2.CreateWeightVersionResponse.SerializeToString,
            ),
            'GetWeightVersion': grpc.unary_unary_rpc_method_handler(
                    servicer.GetWeightVersion,
                    request_deserializer=refit__pb2.GetWeightVersionRequest.FromString,
                    response_serializer=refit__pb2.GetWeightVersionResponse.SerializeToString,
            ),
            'DeleteWeightVersion': grpc.unary_unary_rpc_method_handler(
                    servicer.DeleteWeightVersion,
                    request_deserializer=refit__pb2.DeleteWeightVersionRequest.FromString,
                    response_serializer=refit__pb2.DeleteWeightVersionResponse.SerializeToString,
            ),
            'UpdateWeightVersionState': grpc.unary_unary_rpc_method_handler(
                    servicer.UpdateWeightVersionState,
                    request_deserializer=refit__pb2.UpdateWeightVersionStateRequest.FromString,
                    response_serializer=refit__pb2.UpdateWeightVersionStateResponse.SerializeToString,
            ),
            'RegisterWorker': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterWorker,
                    request_deserializer=refit__pb2.RegisterWorkerRequest.FromString,
                    response_serializer=refit__pb2.RegisterWorkerResponse.SerializeToString,
            ),
            'CreateWeightVersionShard': grpc.unary_unary_rpc_method_handler(
                    servicer.CreateWeightVersionShard,
                    request_deserializer=refit__pb2.CreateWeightVersionShardRequest.FromString,
                    response_serializer=refit__pb2.CreateWeightVersionShardResponse.SerializeToString,
            ),
            'ListWeightVersionShards': grpc.unary_unary_rpc_method_handler(
                    servicer.ListWeightVersionShards,
                    request_deserializer=refit__pb2.ListWeightVersionShardsRequest.FromString,
                    response_serializer=refit__pb2.ListWeightVersionShardsResponse.SerializeToString,
            ),
            'DeleteWeightVersionShard': grpc.unary_unary_rpc_method_handler(
                    servicer.DeleteWeightVersionShard,
                    request_deserializer=refit__pb2.DeleteWeightVersionShardRequest.FromString,
                    response_serializer=refit__pb2.DeleteWeightVersionShardResponse.SerializeToString,
            ),
            'RegisterVersionLease': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterVersionLease,
                    request_deserializer=refit__pb2.RegisterVersionLeaseRequest.FromString,
                    response_serializer=refit__pb2.RegisterVersionLeaseResponse.SerializeToString,
            ),
            'DeleteVersionLease': grpc.unary_unary_rpc_method_handler(
                    servicer.DeleteVersionLease,
                    request_deserializer=refit__pb2.DeleteVersionLeaseRequest.FromString,
                    response_serializer=refit__pb2.DeleteVersionLeaseResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'model_express.refit.RefitService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('model_express.refit.RefitService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class RefitService(object):
    """Control-plane metadata for RL weight publication. Object-storage-backed
    versions own one global object URI; worker-sharded versions advertise
    per-worker manifests.
    """

    @staticmethod
    def CreateWeightVersion(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/CreateWeightVersion',
            refit__pb2.CreateWeightVersionRequest.SerializeToString,
            refit__pb2.CreateWeightVersionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetWeightVersion(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/GetWeightVersion',
            refit__pb2.GetWeightVersionRequest.SerializeToString,
            refit__pb2.GetWeightVersionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DeleteWeightVersion(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/DeleteWeightVersion',
            refit__pb2.DeleteWeightVersionRequest.SerializeToString,
            refit__pb2.DeleteWeightVersionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def UpdateWeightVersionState(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/UpdateWeightVersionState',
            refit__pb2.UpdateWeightVersionStateRequest.SerializeToString,
            refit__pb2.UpdateWeightVersionStateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RegisterWorker(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/RegisterWorker',
            refit__pb2.RegisterWorkerRequest.SerializeToString,
            refit__pb2.RegisterWorkerResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CreateWeightVersionShard(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/CreateWeightVersionShard',
            refit__pb2.CreateWeightVersionShardRequest.SerializeToString,
            refit__pb2.CreateWeightVersionShardResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListWeightVersionShards(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/ListWeightVersionShards',
            refit__pb2.ListWeightVersionShardsRequest.SerializeToString,
            refit__pb2.ListWeightVersionShardsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DeleteWeightVersionShard(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/DeleteWeightVersionShard',
            refit__pb2.DeleteWeightVersionShardRequest.SerializeToString,
            refit__pb2.DeleteWeightVersionShardResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RegisterVersionLease(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/RegisterVersionLease',
            refit__pb2.RegisterVersionLeaseRequest.SerializeToString,
            refit__pb2.RegisterVersionLeaseResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DeleteVersionLease(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitService/DeleteVersionLease',
            refit__pb2.DeleteVersionLeaseRequest.SerializeToString,
            refit__pb2.DeleteVersionLeaseResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)


class RefitWorkerServiceStub(object):
    """Internal worker-to-worker API. The generator fetches the small transfer
    manifest here; tensor bytes remain on the advertised data-plane transport.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.GetWeightVersionShardManifest = channel.unary_unary(
                '/model_express.refit.RefitWorkerService/GetWeightVersionShardManifest',
                request_serializer=refit__pb2.GetWeightVersionShardManifestRequest.SerializeToString,
                response_deserializer=refit__pb2.GetWeightVersionShardManifestResponse.FromString,
                _registered_method=True)


class RefitWorkerServiceServicer(object):
    """Internal worker-to-worker API. The generator fetches the small transfer
    manifest here; tensor bytes remain on the advertised data-plane transport.
    """

    def GetWeightVersionShardManifest(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_RefitWorkerServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetWeightVersionShardManifest': grpc.unary_unary_rpc_method_handler(
                    servicer.GetWeightVersionShardManifest,
                    request_deserializer=refit__pb2.GetWeightVersionShardManifestRequest.FromString,
                    response_serializer=refit__pb2.GetWeightVersionShardManifestResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'model_express.refit.RefitWorkerService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('model_express.refit.RefitWorkerService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class RefitWorkerService(object):
    """Internal worker-to-worker API. The generator fetches the small transfer
    manifest here; tensor bytes remain on the advertised data-plane transport.
    """

    @staticmethod
    def GetWeightVersionShardManifest(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/model_express.refit.RefitWorkerService/GetWeightVersionShardManifest',
            refit__pb2.GetWeightVersionShardManifestRequest.SerializeToString,
            refit__pb2.GetWeightVersionShardManifestResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)