modal 1.0.5.dev2__py3-none-any.whl → 1.0.5.dev4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. modal/_clustered_functions.pyi +13 -3
  2. modal/_functions.py +5 -4
  3. modal/_partial_function.py +1 -1
  4. modal/_runtime/container_io_manager.pyi +222 -40
  5. modal/_runtime/execution_context.pyi +60 -6
  6. modal/_tunnel.pyi +380 -12
  7. modal/app.py +4 -4
  8. modal/app.pyi +658 -48
  9. modal/cli/run.py +2 -1
  10. modal/client.pyi +224 -28
  11. modal/cloud_bucket_mount.pyi +192 -4
  12. modal/cls.py +3 -3
  13. modal/cls.pyi +442 -35
  14. modal/container_process.pyi +103 -14
  15. modal/dict.py +1 -1
  16. modal/dict.pyi +453 -51
  17. modal/environments.pyi +41 -9
  18. modal/exception.py +2 -2
  19. modal/file_io.pyi +236 -45
  20. modal/functions.pyi +545 -56
  21. modal/gpu.py +1 -1
  22. modal/image.py +1 -1
  23. modal/image.pyi +1256 -74
  24. modal/io_streams.pyi +342 -39
  25. modal/mount.pyi +261 -31
  26. modal/network_file_system.pyi +307 -26
  27. modal/object.pyi +48 -9
  28. modal/parallel_map.pyi +144 -14
  29. modal/partial_function.pyi +255 -14
  30. modal/proxy.py +1 -1
  31. modal/proxy.pyi +28 -3
  32. modal/queue.py +1 -1
  33. modal/queue.pyi +447 -30
  34. modal/runner.pyi +160 -22
  35. modal/sandbox.py +7 -7
  36. modal/sandbox.pyi +310 -50
  37. modal/schedule.py +1 -1
  38. modal/secret.py +2 -2
  39. modal/secret.pyi +164 -15
  40. modal/snapshot.pyi +25 -4
  41. modal/token_flow.pyi +28 -8
  42. modal/volume.py +1 -1
  43. modal/volume.pyi +649 -59
  44. {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/METADATA +1 -1
  45. {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/RECORD +50 -50
  46. modal_version/__init__.py +1 -1
  47. {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/WHEEL +0 -0
  48. {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/entry_points.txt +0 -0
  49. {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/licenses/LICENSE +0 -0
  50. {modal-1.0.5.dev2.dist-info → modal-1.0.5.dev4.dist-info}/top_level.txt +0 -0
modal/queue.pyi CHANGED
@@ -7,7 +7,81 @@ import typing
7
7
  import typing_extensions
8
8
 
9
9
  class _Queue(modal._object._Object):
10
- def __init__(self): ...
10
+ """Distributed, FIFO queue for data flow in Modal apps.
11
+
12
+ The queue can contain any object serializable by `cloudpickle`, including Modal objects.
13
+
14
+ By default, the `Queue` object acts as a single FIFO queue which supports puts and gets (blocking and non-blocking).
15
+
16
+ **Usage**
17
+
18
+ ```python
19
+ from modal import Queue
20
+
21
+ # Create an ephemeral queue which is anonymous and garbage collected
22
+ with Queue.ephemeral() as my_queue:
23
+ # Putting values
24
+ my_queue.put("some value")
25
+ my_queue.put(123)
26
+
27
+ # Getting values
28
+ assert my_queue.get() == "some value"
29
+ assert my_queue.get() == 123
30
+
31
+ # Using partitions
32
+ my_queue.put(0)
33
+ my_queue.put(1, partition="foo")
34
+ my_queue.put(2, partition="bar")
35
+
36
+ # Default and "foo" partition are ignored by the get operation.
37
+ assert my_queue.get(partition="bar") == 2
38
+
39
+ # Set custom 10s expiration time on "foo" partition.
40
+ my_queue.put(3, partition="foo", partition_ttl=10)
41
+
42
+ # (beta feature) Iterate through items in place (read immutably)
43
+ my_queue.put(1)
44
+ assert [v for v in my_queue.iterate()] == [0, 1]
45
+
46
+ # You can also create persistent queues that can be used across apps
47
+ queue = Queue.from_name("my-persisted-queue", create_if_missing=True)
48
+ queue.put(42)
49
+ assert queue.get() == 42
50
+ ```
51
+
52
+ For more examples, see the [guide](https://modal.com/docs/guide/dicts-and-queues#modal-queues).
53
+
54
+ **Queue partitions (beta)**
55
+
56
+ Specifying partition keys gives access to other independent FIFO partitions within the same `Queue` object.
57
+ Across any two partitions, puts and gets are completely independent.
58
+ For example, a put in one partition does not affect a get in any other partition.
59
+
60
+ When no partition key is specified (by default), puts and gets will operate on a default partition.
61
+ This default partition is also isolated from all other partitions.
62
+ Please see the Usage section below for an example using partitions.
63
+
64
+ **Lifetime of a queue and its partitions**
65
+
66
+ By default, each partition is cleared 24 hours after the last `put` operation.
67
+ A lower TTL can be specified by the `partition_ttl` argument in the `put` or `put_many` methods.
68
+ Each partition's expiry is handled independently.
69
+
70
+ As such, `Queue`s are best used for communication between active functions and not relied on for persistent storage.
71
+
72
+ On app completion or after stopping an app any associated `Queue` objects are cleaned up.
73
+ All its partitions will be cleared.
74
+
75
+ **Limits**
76
+
77
+ A single `Queue` can contain up to 100,000 partitions, each with up to 5,000 items. Each item can be up to 1 MiB.
78
+
79
+ Partition keys must be non-empty and must not exceed 64 bytes.
80
+ """
81
+ def __init__(self):
82
+ """mdmd:hidden"""
83
+ ...
84
+
11
85
  @staticmethod
12
86
  def validate_partition_key(partition: typing.Optional[str]) -> bytes: ...
13
87
  @classmethod
@@ -16,11 +90,41 @@ class _Queue(modal._object._Object):
16
90
  client: typing.Optional[modal.client._Client] = None,
17
91
  environment_name: typing.Optional[str] = None,
18
92
  _heartbeat_sleep: float = 300,
19
- ) -> typing.AsyncContextManager[_Queue]: ...
93
+ ) -> typing.AsyncContextManager[_Queue]:
94
+ """Creates a new ephemeral queue within a context manager:
95
+
96
+ Usage:
97
+ ```python
98
+ from modal import Queue
99
+
100
+ with Queue.ephemeral() as q:
101
+ q.put(123)
102
+ ```
103
+
104
+ ```python notest
105
+ async with Queue.ephemeral() as q:
106
+ await q.put.aio(123)
107
+ ```
108
+ """
109
+ ...
110
+
20
111
  @staticmethod
21
112
  def from_name(
22
113
  name: str, *, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
23
- ) -> _Queue: ...
114
+ ) -> _Queue:
115
+ """Reference a named Queue, creating if necessary.
116
+
117
+ In contrast to `modal.Queue.lookup`, this is a lazy method
118
+ the defers hydrating the local object with metadata from
119
+ Modal servers until the first time it is actually used.
120
+
121
+ ```python
122
+ q = modal.Queue.from_name("my-queue", create_if_missing=True)
123
+ q.put(123)
124
+ ```
125
+ """
126
+ ...
127
+
24
128
  @staticmethod
25
129
  async def lookup(
26
130
  name: str,
@@ -28,7 +132,22 @@ class _Queue(modal._object._Object):
28
132
  client: typing.Optional[modal.client._Client] = None,
29
133
  environment_name: typing.Optional[str] = None,
30
134
  create_if_missing: bool = False,
31
- ) -> _Queue: ...
135
+ ) -> _Queue:
136
+ """mdmd:hidden
137
+ Lookup a named Queue.
138
+
139
+ DEPRECATED: This method is deprecated in favor of `modal.Queue.from_name`.
140
+
141
+ In contrast to `modal.Queue.from_name`, this is an eager method
142
+ that will hydrate the local object with metadata from Modal servers.
143
+
144
+ ```python notest
145
+ q = modal.Queue.lookup("my-queue")
146
+ q.put(123)
147
+ ```
148
+ """
149
+ ...
150
+
32
151
  @staticmethod
33
152
  async def delete(
34
153
  name: str,
@@ -40,10 +159,24 @@ class _Queue(modal._object._Object):
40
159
  async def _get_blocking(
41
160
  self, partition: typing.Optional[str], timeout: typing.Optional[float], n_values: int
42
161
  ) -> list[typing.Any]: ...
43
- async def clear(self, *, partition: typing.Optional[str] = None, all: bool = False) -> None: ...
162
+ async def clear(self, *, partition: typing.Optional[str] = None, all: bool = False) -> None:
163
+ """Clear the contents of a single partition or all partitions."""
164
+ ...
165
+
44
166
  async def get(
45
167
  self, block: bool = True, timeout: typing.Optional[float] = None, *, partition: typing.Optional[str] = None
46
- ) -> typing.Optional[typing.Any]: ...
168
+ ) -> typing.Optional[typing.Any]:
169
+ """Remove and return the next object in the queue.
170
+
171
+ If `block` is `True` (the default) and the queue is empty, `get` will wait indefinitely for
172
+ an object, or until `timeout` if specified. Raises a native `queue.Empty` exception
173
+ if the `timeout` is reached.
174
+
175
+ If `block` is `False`, `get` returns `None` immediately if the queue is empty. The `timeout` is
176
+ ignored in this case.
177
+ """
178
+ ...
179
+
47
180
  async def get_many(
48
181
  self,
49
182
  n_values: int,
@@ -51,7 +184,20 @@ class _Queue(modal._object._Object):
51
184
  timeout: typing.Optional[float] = None,
52
185
  *,
53
186
  partition: typing.Optional[str] = None,
54
- ) -> list[typing.Any]: ...
187
+ ) -> list[typing.Any]:
188
+ """Remove and return up to `n_values` objects from the queue.
189
+
190
+ If there are fewer than `n_values` items in the queue, return all of them.
191
+
192
+ If `block` is `True` (the default) and the queue is empty, `get` will wait indefinitely for
193
+ at least 1 object to be present, or until `timeout` if specified. Raises the stdlib's `queue.Empty`
194
+ exception if the `timeout` is reached.
195
+
196
+ If `block` is `False`, `get` returns `None` immediately if the queue is empty. The `timeout` is
197
+ ignored in this case.
198
+ """
199
+ ...
200
+
55
201
  async def put(
56
202
  self,
57
203
  v: typing.Any,
@@ -60,7 +206,18 @@ class _Queue(modal._object._Object):
60
206
  *,
61
207
  partition: typing.Optional[str] = None,
62
208
  partition_ttl: int = 86400,
63
- ) -> None: ...
209
+ ) -> None:
210
+ """Add an object to the end of the queue.
211
+
212
+ If `block` is `True` and the queue is full, this method will retry indefinitely or
213
+ until `timeout` if specified. Raises the stdlib's `queue.Full` exception if the `timeout` is reached.
214
+ If blocking it is not recommended to omit the `timeout`, as the operation could wait indefinitely.
215
+
216
+ If `block` is `False`, this method raises `queue.Full` immediately if the queue is full. The `timeout` is
217
+ ignored in this case.
218
+ """
219
+ ...
220
+
64
221
  async def put_many(
65
222
  self,
66
223
  vs: list[typing.Any],
@@ -69,7 +226,18 @@ class _Queue(modal._object._Object):
69
226
  *,
70
227
  partition: typing.Optional[str] = None,
71
228
  partition_ttl: int = 86400,
72
- ) -> None: ...
229
+ ) -> None:
230
+ """Add several objects to the end of the queue.
231
+
232
+ If `block` is `True` and the queue is full, this method will retry indefinitely or
233
+ until `timeout` if specified. Raises the stdlib's `queue.Full` exception if the `timeout` is reached.
234
+ If blocking it is not recommended to omit the `timeout`, as the operation could wait indefinitely.
235
+
236
+ If `block` is `False`, this method raises `queue.Full` immediately if the queue is full. The `timeout` is
237
+ ignored in this case.
238
+ """
239
+ ...
240
+
73
241
  async def _put_many_blocking(
74
242
  self,
75
243
  partition: typing.Optional[str],
@@ -80,15 +248,97 @@ class _Queue(modal._object._Object):
80
248
  async def _put_many_nonblocking(
81
249
  self, partition: typing.Optional[str], partition_ttl: int, vs: list[typing.Any]
82
250
  ): ...
83
- async def len(self, *, partition: typing.Optional[str] = None, total: bool = False) -> int: ...
251
+ async def len(self, *, partition: typing.Optional[str] = None, total: bool = False) -> int:
252
+ """Return the number of objects in the queue partition."""
253
+ ...
254
+
84
255
  def iterate(
85
256
  self, *, partition: typing.Optional[str] = None, item_poll_timeout: float = 0.0
86
- ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
257
+ ) -> collections.abc.AsyncGenerator[typing.Any, None]:
258
+ """(Beta feature) Iterate through items in the queue without mutation.
259
+
260
+ Specify `item_poll_timeout` to control how long the iterator should wait for the next time before giving up.
261
+ """
262
+ ...
87
263
 
88
264
  SUPERSELF = typing.TypeVar("SUPERSELF", covariant=True)
89
265
 
90
266
  class Queue(modal.object.Object):
91
- def __init__(self): ...
267
+ """Distributed, FIFO queue for data flow in Modal apps.
268
+
269
+ The queue can contain any object serializable by `cloudpickle`, including Modal objects.
270
+
271
+ By default, the `Queue` object acts as a single FIFO queue which supports puts and gets (blocking and non-blocking).
272
+
273
+ **Usage**
274
+
275
+ ```python
276
+ from modal import Queue
277
+
278
+ # Create an ephemeral queue which is anonymous and garbage collected
279
+ with Queue.ephemeral() as my_queue:
280
+ # Putting values
281
+ my_queue.put("some value")
282
+ my_queue.put(123)
283
+
284
+ # Getting values
285
+ assert my_queue.get() == "some value"
286
+ assert my_queue.get() == 123
287
+
288
+ # Using partitions
289
+ my_queue.put(0)
290
+ my_queue.put(1, partition="foo")
291
+ my_queue.put(2, partition="bar")
292
+
293
+ # Default and "foo" partition are ignored by the get operation.
294
+ assert my_queue.get(partition="bar") == 2
295
+
296
+ # Set custom 10s expiration time on "foo" partition.
297
+ my_queue.put(3, partition="foo", partition_ttl=10)
298
+
299
+ # (beta feature) Iterate through items in place (read immutably)
300
+ my_queue.put(1)
301
+ assert [v for v in my_queue.iterate()] == [0, 1]
302
+
303
+ # You can also create persistent queues that can be used across apps
304
+ queue = Queue.from_name("my-persisted-queue", create_if_missing=True)
305
+ queue.put(42)
306
+ assert queue.get() == 42
307
+ ```
308
+
309
+ For more examples, see the [guide](https://modal.com/docs/guide/dicts-and-queues#modal-queues).
310
+
311
+ **Queue partitions (beta)**
312
+
313
+ Specifying partition keys gives access to other independent FIFO partitions within the same `Queue` object.
314
+ Across any two partitions, puts and gets are completely independent.
315
+ For example, a put in one partition does not affect a get in any other partition.
316
+
317
+ When no partition key is specified (by default), puts and gets will operate on a default partition.
318
+ This default partition is also isolated from all other partitions.
319
+ Please see the Usage section below for an example using partitions.
320
+
321
+ **Lifetime of a queue and its partitions**
322
+
323
+ By default, each partition is cleared 24 hours after the last `put` operation.
324
+ A lower TTL can be specified by the `partition_ttl` argument in the `put` or `put_many` methods.
325
+ Each partition's expiry is handled independently.
326
+
327
+ As such, `Queue`s are best used for communication between active functions and not relied on for persistent storage.
328
+
329
+ On app completion or after stopping an app any associated `Queue` objects are cleaned up.
330
+ All its partitions will be cleared.
331
+
332
+ **Limits**
333
+
334
+ A single `Queue` can contain up to 100,000 partitions, each with up to 5,000 items. Each item can be up to 1 MiB.
335
+
336
+ Partition keys must be non-empty and must not exceed 64 bytes.
337
+ """
338
+ def __init__(self):
339
+ """mdmd:hidden"""
340
+ ...
341
+
92
342
  @staticmethod
93
343
  def validate_partition_key(partition: typing.Optional[str]) -> bytes: ...
94
344
  @classmethod
@@ -97,11 +347,40 @@ class Queue(modal.object.Object):
97
347
  client: typing.Optional[modal.client.Client] = None,
98
348
  environment_name: typing.Optional[str] = None,
99
349
  _heartbeat_sleep: float = 300,
100
- ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[Queue]: ...
350
+ ) -> synchronicity.combined_types.AsyncAndBlockingContextManager[Queue]:
351
+ """Creates a new ephemeral queue within a context manager:
352
+
353
+ Usage:
354
+ ```python
355
+ from modal import Queue
356
+
357
+ with Queue.ephemeral() as q:
358
+ q.put(123)
359
+ ```
360
+
361
+ ```python notest
362
+ async with Queue.ephemeral() as q:
363
+ await q.put.aio(123)
364
+ ```
365
+ """
366
+ ...
367
+
101
368
  @staticmethod
102
369
  def from_name(
103
370
  name: str, *, namespace=1, environment_name: typing.Optional[str] = None, create_if_missing: bool = False
104
- ) -> Queue: ...
371
+ ) -> Queue:
372
+ """Reference a named Queue, creating if necessary.
373
+
374
+ In contrast to `modal.Queue.lookup`, this is a lazy method
375
+ the defers hydrating the local object with metadata from
376
+ Modal servers until the first time it is actually used.
377
+
378
+ ```python
379
+ q = modal.Queue.from_name("my-queue", create_if_missing=True)
380
+ q.put(123)
381
+ ```
382
+ """
383
+ ...
105
384
 
106
385
  class __lookup_spec(typing_extensions.Protocol):
107
386
  def __call__(
@@ -112,7 +391,22 @@ class Queue(modal.object.Object):
112
391
  client: typing.Optional[modal.client.Client] = None,
113
392
  environment_name: typing.Optional[str] = None,
114
393
  create_if_missing: bool = False,
115
- ) -> Queue: ...
394
+ ) -> Queue:
395
+ """mdmd:hidden
396
+ Lookup a named Queue.
397
+
398
+ DEPRECATED: This method is deprecated in favor of `modal.Queue.from_name`.
399
+
400
+ In contrast to `modal.Queue.from_name`, this is an eager method
401
+ that will hydrate the local object with metadata from Modal servers.
402
+
403
+ ```python notest
404
+ q = modal.Queue.lookup("my-queue")
405
+ q.put(123)
406
+ ```
407
+ """
408
+ ...
409
+
116
410
  async def aio(
117
411
  self,
118
412
  /,
@@ -121,7 +415,21 @@ class Queue(modal.object.Object):
121
415
  client: typing.Optional[modal.client.Client] = None,
122
416
  environment_name: typing.Optional[str] = None,
123
417
  create_if_missing: bool = False,
124
- ) -> Queue: ...
418
+ ) -> Queue:
419
+ """mdmd:hidden
420
+ Lookup a named Queue.
421
+
422
+ DEPRECATED: This method is deprecated in favor of `modal.Queue.from_name`.
423
+
424
+ In contrast to `modal.Queue.from_name`, this is an eager method
425
+ that will hydrate the local object with metadata from Modal servers.
426
+
427
+ ```python notest
428
+ q = modal.Queue.lookup("my-queue")
429
+ q.put(123)
430
+ ```
431
+ """
432
+ ...
125
433
 
126
434
  lookup: __lookup_spec
127
435
 
@@ -162,8 +470,13 @@ class Queue(modal.object.Object):
162
470
  _get_blocking: ___get_blocking_spec[typing_extensions.Self]
163
471
 
164
472
  class __clear_spec(typing_extensions.Protocol[SUPERSELF]):
165
- def __call__(self, /, *, partition: typing.Optional[str] = None, all: bool = False) -> None: ...
166
- async def aio(self, /, *, partition: typing.Optional[str] = None, all: bool = False) -> None: ...
473
+ def __call__(self, /, *, partition: typing.Optional[str] = None, all: bool = False) -> None:
474
+ """Clear the contents of a single partition or all partitions."""
475
+ ...
476
+
477
+ async def aio(self, /, *, partition: typing.Optional[str] = None, all: bool = False) -> None:
478
+ """Clear the contents of a single partition or all partitions."""
479
+ ...
167
480
 
168
481
  clear: __clear_spec[typing_extensions.Self]
169
482
 
@@ -175,7 +488,18 @@ class Queue(modal.object.Object):
175
488
  timeout: typing.Optional[float] = None,
176
489
  *,
177
490
  partition: typing.Optional[str] = None,
178
- ) -> typing.Optional[typing.Any]: ...
491
+ ) -> typing.Optional[typing.Any]:
492
+ """Remove and return the next object in the queue.
493
+
494
+ If `block` is `True` (the default) and the queue is empty, `get` will wait indefinitely for
495
+ an object, or until `timeout` if specified. Raises a native `queue.Empty` exception
496
+ if the `timeout` is reached.
497
+
498
+ If `block` is `False`, `get` returns `None` immediately if the queue is empty. The `timeout` is
499
+ ignored in this case.
500
+ """
501
+ ...
502
+
179
503
  async def aio(
180
504
  self,
181
505
  /,
@@ -183,7 +507,17 @@ class Queue(modal.object.Object):
183
507
  timeout: typing.Optional[float] = None,
184
508
  *,
185
509
  partition: typing.Optional[str] = None,
186
- ) -> typing.Optional[typing.Any]: ...
510
+ ) -> typing.Optional[typing.Any]:
511
+ """Remove and return the next object in the queue.
512
+
513
+ If `block` is `True` (the default) and the queue is empty, `get` will wait indefinitely for
514
+ an object, or until `timeout` if specified. Raises a native `queue.Empty` exception
515
+ if the `timeout` is reached.
516
+
517
+ If `block` is `False`, `get` returns `None` immediately if the queue is empty. The `timeout` is
518
+ ignored in this case.
519
+ """
520
+ ...
187
521
 
188
522
  get: __get_spec[typing_extensions.Self]
189
523
 
@@ -196,7 +530,20 @@ class Queue(modal.object.Object):
196
530
  timeout: typing.Optional[float] = None,
197
531
  *,
198
532
  partition: typing.Optional[str] = None,
199
- ) -> list[typing.Any]: ...
533
+ ) -> list[typing.Any]:
534
+ """Remove and return up to `n_values` objects from the queue.
535
+
536
+ If there are fewer than `n_values` items in the queue, return all of them.
537
+
538
+ If `block` is `True` (the default) and the queue is empty, `get` will wait indefinitely for
539
+ at least 1 object to be present, or until `timeout` if specified. Raises the stdlib's `queue.Empty`
540
+ exception if the `timeout` is reached.
541
+
542
+ If `block` is `False`, `get` returns `None` immediately if the queue is empty. The `timeout` is
543
+ ignored in this case.
544
+ """
545
+ ...
546
+
200
547
  async def aio(
201
548
  self,
202
549
  /,
@@ -205,7 +552,19 @@ class Queue(modal.object.Object):
205
552
  timeout: typing.Optional[float] = None,
206
553
  *,
207
554
  partition: typing.Optional[str] = None,
208
- ) -> list[typing.Any]: ...
555
+ ) -> list[typing.Any]:
556
+ """Remove and return up to `n_values` objects from the queue.
557
+
558
+ If there are fewer than `n_values` items in the queue, return all of them.
559
+
560
+ If `block` is `True` (the default) and the queue is empty, `get` will wait indefinitely for
561
+ at least 1 object to be present, or until `timeout` if specified. Raises the stdlib's `queue.Empty`
562
+ exception if the `timeout` is reached.
563
+
564
+ If `block` is `False`, `get` returns `None` immediately if the queue is empty. The `timeout` is
565
+ ignored in this case.
566
+ """
567
+ ...
209
568
 
210
569
  get_many: __get_many_spec[typing_extensions.Self]
211
570
 
@@ -219,7 +578,18 @@ class Queue(modal.object.Object):
219
578
  *,
220
579
  partition: typing.Optional[str] = None,
221
580
  partition_ttl: int = 86400,
222
- ) -> None: ...
581
+ ) -> None:
582
+ """Add an object to the end of the queue.
583
+
584
+ If `block` is `True` and the queue is full, this method will retry indefinitely or
585
+ until `timeout` if specified. Raises the stdlib's `queue.Full` exception if the `timeout` is reached.
586
+ If blocking it is not recommended to omit the `timeout`, as the operation could wait indefinitely.
587
+
588
+ If `block` is `False`, this method raises `queue.Full` immediately if the queue is full. The `timeout` is
589
+ ignored in this case.
590
+ """
591
+ ...
592
+
223
593
  async def aio(
224
594
  self,
225
595
  /,
@@ -229,7 +599,17 @@ class Queue(modal.object.Object):
229
599
  *,
230
600
  partition: typing.Optional[str] = None,
231
601
  partition_ttl: int = 86400,
232
- ) -> None: ...
602
+ ) -> None:
603
+ """Add an object to the end of the queue.
604
+
605
+ If `block` is `True` and the queue is full, this method will retry indefinitely or
606
+ until `timeout` if specified. Raises the stdlib's `queue.Full` exception if the `timeout` is reached.
607
+ If blocking it is not recommended to omit the `timeout`, as the operation could wait indefinitely.
608
+
609
+ If `block` is `False`, this method raises `queue.Full` immediately if the queue is full. The `timeout` is
610
+ ignored in this case.
611
+ """
612
+ ...
233
613
 
234
614
  put: __put_spec[typing_extensions.Self]
235
615
 
@@ -243,7 +623,18 @@ class Queue(modal.object.Object):
243
623
  *,
244
624
  partition: typing.Optional[str] = None,
245
625
  partition_ttl: int = 86400,
246
- ) -> None: ...
626
+ ) -> None:
627
+ """Add several objects to the end of the queue.
628
+
629
+ If `block` is `True` and the queue is full, this method will retry indefinitely or
630
+ until `timeout` if specified. Raises the stdlib's `queue.Full` exception if the `timeout` is reached.
631
+ If blocking it is not recommended to omit the `timeout`, as the operation could wait indefinitely.
632
+
633
+ If `block` is `False`, this method raises `queue.Full` immediately if the queue is full. The `timeout` is
634
+ ignored in this case.
635
+ """
636
+ ...
637
+
247
638
  async def aio(
248
639
  self,
249
640
  /,
@@ -253,7 +644,17 @@ class Queue(modal.object.Object):
253
644
  *,
254
645
  partition: typing.Optional[str] = None,
255
646
  partition_ttl: int = 86400,
256
- ) -> None: ...
647
+ ) -> None:
648
+ """Add several objects to the end of the queue.
649
+
650
+ If `block` is `True` and the queue is full, this method will retry indefinitely or
651
+ until `timeout` if specified. Raises the stdlib's `queue.Full` exception if the `timeout` is reached.
652
+ If blocking it is not recommended to omit the `timeout`, as the operation could wait indefinitely.
653
+
654
+ If `block` is `False`, this method raises `queue.Full` immediately if the queue is full. The `timeout` is
655
+ ignored in this case.
656
+ """
657
+ ...
257
658
 
258
659
  put_many: __put_many_spec[typing_extensions.Self]
259
660
 
@@ -284,17 +685,33 @@ class Queue(modal.object.Object):
284
685
  _put_many_nonblocking: ___put_many_nonblocking_spec[typing_extensions.Self]
285
686
 
286
687
  class __len_spec(typing_extensions.Protocol[SUPERSELF]):
287
- def __call__(self, /, *, partition: typing.Optional[str] = None, total: bool = False) -> int: ...
288
- async def aio(self, /, *, partition: typing.Optional[str] = None, total: bool = False) -> int: ...
688
+ def __call__(self, /, *, partition: typing.Optional[str] = None, total: bool = False) -> int:
689
+ """Return the number of objects in the queue partition."""
690
+ ...
691
+
692
+ async def aio(self, /, *, partition: typing.Optional[str] = None, total: bool = False) -> int:
693
+ """Return the number of objects in the queue partition."""
694
+ ...
289
695
 
290
696
  len: __len_spec[typing_extensions.Self]
291
697
 
292
698
  class __iterate_spec(typing_extensions.Protocol[SUPERSELF]):
293
699
  def __call__(
294
700
  self, /, *, partition: typing.Optional[str] = None, item_poll_timeout: float = 0.0
295
- ) -> typing.Generator[typing.Any, None, None]: ...
701
+ ) -> typing.Generator[typing.Any, None, None]:
702
+ """(Beta feature) Iterate through items in the queue without mutation.
703
+
704
+ Specify `item_poll_timeout` to control how long the iterator should wait for the next time before giving up.
705
+ """
706
+ ...
707
+
296
708
  def aio(
297
709
  self, /, *, partition: typing.Optional[str] = None, item_poll_timeout: float = 0.0
298
- ) -> collections.abc.AsyncGenerator[typing.Any, None]: ...
710
+ ) -> collections.abc.AsyncGenerator[typing.Any, None]:
711
+ """(Beta feature) Iterate through items in the queue without mutation.
712
+
713
+ Specify `item_poll_timeout` to control how long the iterator should wait for the next time before giving up.
714
+ """
715
+ ...
299
716
 
300
717
  iterate: __iterate_spec[typing_extensions.Self]