modal 1.1.5.dev49__py3-none-any.whl → 1.1.5.dev52__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.

Potentially problematic release.


This version of modal might be problematic. Click here for more details.

modal/_output.py CHANGED
@@ -35,7 +35,7 @@ from modal._utils.time_utils import timestamp_to_localized_str
35
35
  from modal_proto import api_pb2
36
36
 
37
37
  from ._utils.grpc_utils import RETRYABLE_GRPC_STATUS_CODES, retry_transient_errors
38
- from ._utils.shell_utils import stream_from_stdin
38
+ from ._utils.shell_utils import stream_from_stdin, write_to_fd
39
39
  from .client import _Client
40
40
  from .config import logger
41
41
 
@@ -507,17 +507,32 @@ async def put_pty_content(log: api_pb2.TaskLogs, stdout):
507
507
  # because the progress spinner can't interfere with output.
508
508
 
509
509
  data = log.data.encode("utf-8")
510
- written = 0
511
- n_retries = 0
512
- while written < len(data):
513
- try:
514
- written += stdout.buffer.write(data[written:])
515
- stdout.flush()
516
- except BlockingIOError:
517
- if n_retries >= 5:
518
- raise
519
- n_retries += 1
520
- await asyncio.sleep(0.1)
510
+ # Non-blocking terminals can fill the kernel buffer on output bursts, making flush() raise
511
+ # BlockingIOError (EAGAIN) and appear frozen until a key is pressed (this happened e.g. when
512
+ # printing large data from a pdb breakpoint). If stdout has a real fd, we await a
513
+ # non-blocking fd write (write_to_fd) instead.
514
+ fd = None
515
+ try:
516
+ if hasattr(stdout, "fileno"):
517
+ fd = stdout.fileno()
518
+ except Exception:
519
+ fd = None
520
+
521
+ if fd is not None:
522
+ await write_to_fd(fd, data)
523
+ else:
524
+ # For streams without fileno(), use the normal write/flush path.
525
+ written = 0
526
+ n_retries = 0
527
+ while written < len(data):
528
+ try:
529
+ written += stdout.buffer.write(data[written:])
530
+ stdout.flush()
531
+ except BlockingIOError:
532
+ if n_retries >= 5:
533
+ raise
534
+ n_retries += 1
535
+ await asyncio.sleep(0.1)
521
536
  else:
522
537
  # `stdout` isn't always buffered (e.g. %%capture in Jupyter notebooks redirects it to
523
538
  # io.StringIO).
@@ -18,6 +18,12 @@ from modal.config import config, logger
18
18
 
19
19
  CUDA_CHECKPOINT_PATH: str = config.get("cuda_checkpoint_path")
20
20
 
21
+ # Maximum total duration for an entire toggle operation.
22
+ CUDA_CHECKPOINT_TOGGLE_TIMEOUT: float = 5 * 60.0
23
+
24
+ # Maximum total duration for each individual `cuda-checkpoint` invocation.
25
+ CUDA_CHECKPOINT_TIMEOUT: float = 90
26
+
21
27
 
22
28
  class CudaCheckpointState(Enum):
23
29
  """State representation from the CUDA API [1].
@@ -44,7 +50,7 @@ class CudaCheckpointProcess:
44
50
  pid: int
45
51
  state: CudaCheckpointState
46
52
 
47
- def toggle(self, target_state: CudaCheckpointState, timeout_secs: float = 5 * 60.0) -> None:
53
+ def toggle(self, target_state: CudaCheckpointState, skip_first_refresh: bool = False) -> None:
48
54
  """Toggle CUDA checkpoint state for current process, moving GPU memory to the
49
55
  CPU and back depending on the current process state when called.
50
56
  """
@@ -54,7 +60,11 @@ class CudaCheckpointProcess:
54
60
  retry_count = 0
55
61
  max_retries = 3
56
62
 
57
- while self._should_continue_toggle(target_state, start_time, timeout_secs):
63
+ attempts = 0
64
+ while self._should_continue_toggle(
65
+ target_state, start_time, refresh=not (skip_first_refresh and attempts == 0)
66
+ ):
67
+ attempts += 1
58
68
  try:
59
69
  self._execute_toggle_command()
60
70
  # Use exponential backoff for retries
@@ -73,10 +83,11 @@ class CudaCheckpointProcess:
73
83
  logger.debug(f"PID: {self.pid} Target state {target_state.value} reached")
74
84
 
75
85
  def _should_continue_toggle(
76
- self, target_state: CudaCheckpointState, start_time: float, timeout_secs: float
86
+ self, target_state: CudaCheckpointState, start_time: float, refresh: bool = True
77
87
  ) -> bool:
78
88
  """Check if toggle operation should continue based on current state and timeout."""
79
- self.refresh_state()
89
+ if refresh:
90
+ self.refresh_state()
80
91
 
81
92
  if self.state == target_state:
82
93
  return False
@@ -85,7 +96,7 @@ class CudaCheckpointProcess:
85
96
  raise CudaCheckpointException(f"PID: {self.pid} CUDA process state is {self.state}")
86
97
 
87
98
  elapsed = time.monotonic() - start_time
88
- if elapsed >= timeout_secs:
99
+ if elapsed >= CUDA_CHECKPOINT_TOGGLE_TIMEOUT:
89
100
  raise CudaCheckpointException(
90
101
  f"PID: {self.pid} Timeout after {elapsed:.2f}s waiting for state {target_state.value}. "
91
102
  f"Current state: {self.state}"
@@ -101,7 +112,7 @@ class CudaCheckpointProcess:
101
112
  check=True,
102
113
  capture_output=True,
103
114
  text=True,
104
- timeout=30,
115
+ timeout=CUDA_CHECKPOINT_TIMEOUT,
105
116
  )
106
117
  logger.debug(f"PID: {self.pid} Successfully toggled CUDA checkpoint state")
107
118
  except subprocess.CalledProcessError as e:
@@ -121,7 +132,7 @@ class CudaCheckpointProcess:
121
132
  check=True,
122
133
  capture_output=True,
123
134
  text=True,
124
- timeout=10,
135
+ timeout=CUDA_CHECKPOINT_TIMEOUT,
125
136
  )
126
137
 
127
138
  state_str = result.stdout.strip().lower()
@@ -190,6 +201,7 @@ class CudaCheckpointSession:
190
201
  [CUDA_CHECKPOINT_PATH, "--get-state", "--pid", str(pid)],
191
202
  capture_output=True,
192
203
  text=True,
204
+ # This should be quick since no checkpoint has taken place yet
193
205
  timeout=5,
194
206
  )
195
207
 
@@ -256,20 +268,11 @@ class CudaCheckpointSession:
256
268
  logger.debug("No CUDA sessions to restore.")
257
269
  return
258
270
 
259
- # Validate all states first
260
- for proc in self.cuda_processes:
261
- proc.refresh_state() # Refresh state before validation
262
- if proc.state != CudaCheckpointState.CHECKPOINTED:
263
- raise CudaCheckpointException(
264
- f"PID {proc.pid}: CUDA session not in {CudaCheckpointState.CHECKPOINTED.value} state. "
265
- f"Current state: {proc.state.value}"
266
- )
267
-
268
271
  # See checkpoint() for rationale about parallelism.
269
272
  start = time.perf_counter()
270
273
 
271
274
  def restore_process(proc: CudaCheckpointProcess) -> None:
272
- proc.toggle(CudaCheckpointState.RUNNING)
275
+ proc.toggle(CudaCheckpointState.RUNNING, skip_first_refresh=True)
273
276
 
274
277
  with ThreadPoolExecutor() as executor:
275
278
  futures = [executor.submit(restore_process, proc) for proc in self.cuda_processes]
modal/client.pyi CHANGED
@@ -33,7 +33,7 @@ class _Client:
33
33
  server_url: str,
34
34
  client_type: int,
35
35
  credentials: typing.Optional[tuple[str, str]],
36
- version: str = "1.1.5.dev49",
36
+ version: str = "1.1.5.dev52",
37
37
  ):
38
38
  """mdmd:hidden
39
39
  The Modal client object is not intended to be instantiated directly by users.
@@ -164,7 +164,7 @@ class Client:
164
164
  server_url: str,
165
165
  client_type: int,
166
166
  credentials: typing.Optional[tuple[str, str]],
167
- version: str = "1.1.5.dev49",
167
+ version: str = "1.1.5.dev52",
168
168
  ):
169
169
  """mdmd:hidden
170
170
  The Modal client object is not intended to be instantiated directly by users.
modal/functions.pyi CHANGED
@@ -450,7 +450,7 @@ class Function(
450
450
 
451
451
  _call_generator: ___call_generator_spec[typing_extensions.Self]
452
452
 
453
- class __remote_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
453
+ class __remote_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
454
454
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> ReturnType_INNER:
455
455
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
456
456
  ...
@@ -459,7 +459,7 @@ class Function(
459
459
  """Calls the function remotely, executing it with the given arguments and returning the execution's result."""
460
460
  ...
461
461
 
462
- remote: __remote_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
462
+ remote: __remote_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
463
463
 
464
464
  class __remote_gen_spec(typing_extensions.Protocol[SUPERSELF]):
465
465
  def __call__(self, /, *args, **kwargs) -> typing.Generator[typing.Any, None, None]:
@@ -486,7 +486,7 @@ class Function(
486
486
  """
487
487
  ...
488
488
 
489
- class ___experimental_spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
489
+ class ___experimental_spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
490
490
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
491
491
  """[Experimental] Calls the function with the given arguments, without waiting for the results.
492
492
 
@@ -510,7 +510,7 @@ class Function(
510
510
  ...
511
511
 
512
512
  _experimental_spawn: ___experimental_spawn_spec[
513
- modal._functions.P, modal._functions.ReturnType, typing_extensions.Self
513
+ modal._functions.ReturnType, modal._functions.P, typing_extensions.Self
514
514
  ]
515
515
 
516
516
  class ___spawn_map_inner_spec(typing_extensions.Protocol[P_INNER, SUPERSELF]):
@@ -519,7 +519,7 @@ class Function(
519
519
 
520
520
  _spawn_map_inner: ___spawn_map_inner_spec[modal._functions.P, typing_extensions.Self]
521
521
 
522
- class __spawn_spec(typing_extensions.Protocol[P_INNER, ReturnType_INNER, SUPERSELF]):
522
+ class __spawn_spec(typing_extensions.Protocol[ReturnType_INNER, P_INNER, SUPERSELF]):
523
523
  def __call__(self, /, *args: P_INNER.args, **kwargs: P_INNER.kwargs) -> FunctionCall[ReturnType_INNER]:
524
524
  """Calls the function with the given arguments, without waiting for the results.
525
525
 
@@ -540,7 +540,7 @@ class Function(
540
540
  """
541
541
  ...
542
542
 
543
- spawn: __spawn_spec[modal._functions.P, modal._functions.ReturnType, typing_extensions.Self]
543
+ spawn: __spawn_spec[modal._functions.ReturnType, modal._functions.P, typing_extensions.Self]
544
544
 
545
545
  def get_raw_f(self) -> collections.abc.Callable[..., typing.Any]:
546
546
  """Return the inner Python object wrapped by this Modal Function."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modal
3
- Version: 1.1.5.dev49
3
+ Version: 1.1.5.dev52
4
4
  Summary: Python client library for Modal
5
5
  Author-email: Modal Labs <support@modal.com>
6
6
  License: Apache-2.0
@@ -7,7 +7,7 @@ modal/_functions.py,sha256=6e4rFdl8thTnRuhUOj_4ehOzC1wdvJHhYSoIwB0LXhU,91783
7
7
  modal/_ipython.py,sha256=TW1fkVOmZL3YYqdS2YlM1hqpf654Yf8ZyybHdBnlhSw,301
8
8
  modal/_location.py,sha256=joiX-0ZeutEUDTrrqLF1GHXCdVLF-rHzstocbMcd_-k,366
9
9
  modal/_object.py,sha256=gwsLdXb-Ecd8nH8LVCo8oVZPzzdyo9BrN1DjgQmsSuM,11967
10
- modal/_output.py,sha256=G9CeSQEBzjhveWWEzWmYa5Uwbu4lZf8N8IFH1UM4fU0,25803
10
+ modal/_output.py,sha256=h7wyYPtHdWFgtiWg-5obZI07RaNwivoEiLCUPl8ZOKc,26522
11
11
  modal/_partial_function.py,sha256=Yqk97hLS6vi8nWWVpzS5TSWbndWMdCtkhccdnyDJgBk,37302
12
12
  modal/_pty.py,sha256=E58MQ8d5-wkbMatRKpQR-G9FdbCRcZGiZxOpGy__VuY,1481
13
13
  modal/_resolver.py,sha256=2RWvm34cNSnbv1v7izJMNZgfvpLDD6LzaBlr0lIrLnY,7364
@@ -22,7 +22,7 @@ modal/app.py,sha256=RRUz2NjAWIQLHtU2IEslOlnIOCxPiWts3IP3rTFArkY,49635
22
22
  modal/app.pyi,sha256=CDp_rlX3hBuFdv9VRsKvNKCgu_hS2IO2uNU5qhzmXps,44719
23
23
  modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
24
24
  modal/client.py,sha256=kyAIVB3Ay-XKJizQ_1ufUFB__EagV0MLmHJpyYyJ7J0,18636
25
- modal/client.pyi,sha256=K_pIkzUJpPR7aFiPQPfdIs8spI7by2FSpqjWbpHqmRg,15831
25
+ modal/client.pyi,sha256=88q9g9WIFGDAWQpiFIyjAeyexpoG5-3npFQ1LHKS5us,15831
26
26
  modal/cloud_bucket_mount.py,sha256=I2GRXYhOWLIz2kJZjXu75jAm9EJkBNcutGc6jR2ReUw,5928
27
27
  modal/cloud_bucket_mount.pyi,sha256=VuUOipMIHqFXMkD-3g2bsoqpSxV5qswlFHDOqPQzYAo,7405
28
28
  modal/cls.py,sha256=R1uLQbdqWRRjvxs0I57a4hZZELZkBVCxOKxvKryU5_s,41639
@@ -39,7 +39,7 @@ modal/file_io.py,sha256=OSKr77TujcXGJW1iikzYiHckLSmv07QBgBHcxxYEkoI,21456
39
39
  modal/file_io.pyi,sha256=xtO6Glf_BFwDE7QiQQo24QqcMf_Vv-iz7WojcGVlLBU,15932
40
40
  modal/file_pattern_matcher.py,sha256=A_Kdkej6q7YQyhM_2-BvpFmPqJ0oHb54B6yf9VqvPVE,8116
41
41
  modal/functions.py,sha256=kcNHvqeGBxPI7Cgd57NIBBghkfbeFJzXO44WW0jSmao,325
42
- modal/functions.pyi,sha256=FU1F_75_-Y-YEWo6UNxvmuQ8P3T8TNgpqEqhgED4dhc,39597
42
+ modal/functions.pyi,sha256=9hHRHIkzRtaUWtAHZEmGSUmufyPfgB1JK0kgBipfbys,39597
43
43
  modal/gpu.py,sha256=Fe5ORvVPDIstSq1xjmM6OoNgLYFWvogP9r5BgmD3hYg,6769
44
44
  modal/image.py,sha256=pCiIeDt-YDpzBZ7_uqPcuizRniZYG34Z_NDMCsIIjas,108084
45
45
  modal/image.pyi,sha256=ZNp48mVPzcQ6XNvxin1iO5XrZ89vfEZvU1Bi-V57jq0,76835
@@ -86,7 +86,7 @@ modal/_runtime/container_io_manager.py,sha256=HZJsAC7Vn1a3EXpyJAMuOibsFulHpWlqTE
86
86
  modal/_runtime/container_io_manager.pyi,sha256=GDNLirCcPMRc6gckInYKmGmJZY3LNcgUVXKftt9P9jI,23493
87
87
  modal/_runtime/execution_context.py,sha256=AYrNQRHHXEqX2MwMf8zxelKZnYf25RE_B-NRLWf93n8,3521
88
88
  modal/_runtime/execution_context.pyi,sha256=FVzakehz72ndL-ufe8-EC7TM4IHO_MEBcAdgWuU4W9k,2426
89
- modal/_runtime/gpu_memory_snapshot.py,sha256=BWIMKkH-UXTQOJJuXbM15UWCHHSYlJ0XxGlZunKb0Ug,11877
89
+ modal/_runtime/gpu_memory_snapshot.py,sha256=8T85kyfGJ11AnhFRCZTeWj9zin9e9f5XbrRqU8_WjAk,11955
90
90
  modal/_runtime/telemetry.py,sha256=T1RoAGyjBDr1swiM6pPsGRSITm7LI5FDK18oNXxY08U,5163
91
91
  modal/_runtime/user_code_imports.py,sha256=1MlOgw810aj0MeDvFPvHBIz-aHd7jUX6dwRfIcM3-KE,16498
92
92
  modal/_utils/__init__.py,sha256=waLjl5c6IPDhSsdWAm9Bji4e2PVxamYABKAze6CHVXY,28
@@ -153,7 +153,7 @@ modal/experimental/__init__.py,sha256=fCqzo_f3vcY750vHtd7CtLs5dvdM_C0ZLLGb3zXuK9
153
153
  modal/experimental/flash.py,sha256=7qRAL2Nrwbb60YKobcnpM0zJ8vw4xGJqabLPFgEzMZE,28295
154
154
  modal/experimental/flash.pyi,sha256=R9VV0UDotiY9BRUjacB-xI4qhR3yBymAvEZFRFHztLs,15143
155
155
  modal/experimental/ipython.py,sha256=TrCfmol9LGsRZMeDoeMPx3Hv3BFqQhYnmD_iH0pqdhk,2904
156
- modal-1.1.5.dev49.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
156
+ modal-1.1.5.dev52.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
157
157
  modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
158
158
  modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
159
159
  modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
@@ -161,13 +161,13 @@ modal_docs/mdmd/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,2
161
161
  modal_docs/mdmd/mdmd.py,sha256=tUTImNd4UMFk1opkaw8J672gX8AkBO5gbY2S_NMxsxs,7140
162
162
  modal_docs/mdmd/signatures.py,sha256=XJaZrK7Mdepk5fdX51A8uENiLFNil85Ud0d4MH8H5f0,3218
163
163
  modal_proto/__init__.py,sha256=MIEP8jhXUeGq_eCjYFcqN5b1bxBM4fdk0VESpjWR0fc,28
164
- modal_proto/api.proto,sha256=hN0KacVe7fpAAN0GPGVSEeWTTi4hReDfVmvegN2IsZ4,109060
165
- modal_proto/api_grpc.py,sha256=2KC4gGgqj7FahTrmZD5Gvxs2yV9_5l65yWjLuEd5dNQ,132154
166
- modal_proto/api_pb2.py,sha256=6bKElO_Pt3S6YTwGx2nxb0Cl694MxzYnPSvCTdL9csU,379863
167
- modal_proto/api_pb2.pyi,sha256=8I-Vo42yQjPoJolheJDk0vxrZx5uWdqdePlBYhQbHg0,525036
168
- modal_proto/api_pb2_grpc.py,sha256=nh3_94du1FMglF7sgVfk-s3XCl4vc07Mu-6qe6e0DdY,284763
169
- modal_proto/api_pb2_grpc.pyi,sha256=7X2WZeHyKJWsyEXyzoOdLlU3NT7jhWbaWDZw_-C6EeU,66726
170
- modal_proto/modal_api_grpc.py,sha256=UTgAj4GMOSZmwJBgrhZYnKOyWP1rQQS_HSnlfKkKT5s,19929
164
+ modal_proto/api.proto,sha256=7VHunG16zrHWb6QZQ69SZoqMCwtbhhnE8N2KCUu9kUw,109391
165
+ modal_proto/api_grpc.py,sha256=uA2UlaOWKR8vOq3MCRC_dbqB3vcl0jfpHtDzgDJd1uo,133054
166
+ modal_proto/api_pb2.py,sha256=BDY2mO2b-Lb5RvP8o4tlOkJLbcIXK33IXgrThF5_hrk,381409
167
+ modal_proto/api_pb2.pyi,sha256=-F95nswVuBe_k4FRKZ7f4RjpWs7p1Sgm_nwGrkPJE4c,526019
168
+ modal_proto/api_pb2_grpc.py,sha256=TZRVnkM0KoXbPkV86bFGH-YVfEwMf1dXzJMfcDPURu0,286578
169
+ modal_proto/api_pb2_grpc.pyi,sha256=KDTR99gf00Vrp2aA8FPDY3xxSqJ06HpL9uw2117PYTs,67175
170
+ modal_proto/modal_api_grpc.py,sha256=MajAfiiJUJaZ3oRKDss4i-PDxNLDRTLkw9mptD90nxI,20063
171
171
  modal_proto/modal_options_grpc.py,sha256=qJ1cuwA54oRqrdTyPTbvfhFZYd9HhJKK5UCwt523r3Y,120
172
172
  modal_proto/options.proto,sha256=zp9h5r61ivsp0XwEWwNBsVqNTbRA1VSY_UtN7sEcHtE,549
173
173
  modal_proto/options_grpc.py,sha256=M18X3d-8F_cNYSVM3I25dUTO5rZ0rd-vCCfynfh13Nc,125
@@ -182,10 +182,10 @@ modal_proto/sandbox_router_pb2.py,sha256=INd9izYaIYqllESQt4MSv2Rj9Hf5bMjAvtCc9b4
182
182
  modal_proto/sandbox_router_pb2.pyi,sha256=YCK0WnCgRos3-p7t4USQQ7x6WAuM278yeQX2IeU5mLg,13295
183
183
  modal_proto/sandbox_router_pb2_grpc.py,sha256=zonC5flvCwxeZYJPENj1IJo2Mr0J58DpoC1_8IdPYik,8243
184
184
  modal_proto/sandbox_router_pb2_grpc.pyi,sha256=4QgCB9b7_ykvH8YD-hfnogVH9CLyHVDC5QNb03l4_X8,2735
185
- modal_version/__init__.py,sha256=mM4WmtQdr6bl4_q5Ng9gd1RJp3mSrMgTTZdiwzjaWU8,121
185
+ modal_version/__init__.py,sha256=Xg8_Tklblx3LORhBdVEOf2vdRZLbs54ReBWogH_UTZY,121
186
186
  modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
187
- modal-1.1.5.dev49.dist-info/METADATA,sha256=HUxfOE14ZAHVPzaxsZZ49AVDi3_9iCgp6FfL1MPR_Z8,2481
188
- modal-1.1.5.dev49.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
189
- modal-1.1.5.dev49.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
190
- modal-1.1.5.dev49.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
191
- modal-1.1.5.dev49.dist-info/RECORD,,
187
+ modal-1.1.5.dev52.dist-info/METADATA,sha256=HYMWn_-7J-j8-kK13Dp4N940_-LG1-smuLwvuNAZLJM,2481
188
+ modal-1.1.5.dev52.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
189
+ modal-1.1.5.dev52.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
190
+ modal-1.1.5.dev52.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
191
+ modal-1.1.5.dev52.dist-info/RECORD,,
modal_proto/api.proto CHANGED
@@ -1345,6 +1345,14 @@ message FlashProxyUpstreamRequest {
1345
1345
  double timestamp = 2;
1346
1346
  }
1347
1347
 
1348
+ message FlashSetTargetSlotsMetricsRequest {
1349
+ // TODO(claudia): add other metrics to use in autoscaling decisions
1350
+ string function_id = 1;
1351
+ uint32 target_slots = 2;
1352
+ }
1353
+
1354
+ message FlashSetTargetSlotsMetricsResponse {}
1355
+
1348
1356
  message Function {
1349
1357
  string module_name = 1;
1350
1358
  string function_name = 2;
@@ -3629,6 +3637,7 @@ service ModalClient {
3629
3637
  rpc FlashContainerDeregister(FlashContainerDeregisterRequest) returns (google.protobuf.Empty);
3630
3638
  rpc FlashContainerList(FlashContainerListRequest) returns (FlashContainerListResponse);
3631
3639
  rpc FlashContainerRegister(FlashContainerRegisterRequest) returns (FlashContainerRegisterResponse);
3640
+ rpc FlashSetTargetSlotsMetrics(FlashSetTargetSlotsMetricsRequest) returns (FlashSetTargetSlotsMetricsResponse);
3632
3641
 
3633
3642
  // Functions
3634
3643
  rpc FunctionAsyncInvoke(FunctionAsyncInvokeRequest) returns (FunctionAsyncInvokeResponse);
modal_proto/api_grpc.py CHANGED
@@ -262,6 +262,10 @@ class ModalClientBase(abc.ABC):
262
262
  async def FlashContainerRegister(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.FlashContainerRegisterRequest, modal_proto.api_pb2.FlashContainerRegisterResponse]') -> None:
263
263
  pass
264
264
 
265
+ @abc.abstractmethod
266
+ async def FlashSetTargetSlotsMetrics(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.FlashSetTargetSlotsMetricsRequest, modal_proto.api_pb2.FlashSetTargetSlotsMetricsResponse]') -> None:
267
+ pass
268
+
265
269
  @abc.abstractmethod
266
270
  async def FunctionAsyncInvoke(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.FunctionAsyncInvokeRequest, modal_proto.api_pb2.FunctionAsyncInvokeResponse]') -> None:
267
271
  pass
@@ -1070,6 +1074,12 @@ class ModalClientBase(abc.ABC):
1070
1074
  modal_proto.api_pb2.FlashContainerRegisterRequest,
1071
1075
  modal_proto.api_pb2.FlashContainerRegisterResponse,
1072
1076
  ),
1077
+ '/modal.client.ModalClient/FlashSetTargetSlotsMetrics': grpclib.const.Handler(
1078
+ self.FlashSetTargetSlotsMetrics,
1079
+ grpclib.const.Cardinality.UNARY_UNARY,
1080
+ modal_proto.api_pb2.FlashSetTargetSlotsMetricsRequest,
1081
+ modal_proto.api_pb2.FlashSetTargetSlotsMetricsResponse,
1082
+ ),
1073
1083
  '/modal.client.ModalClient/FunctionAsyncInvoke': grpclib.const.Handler(
1074
1084
  self.FunctionAsyncInvoke,
1075
1085
  grpclib.const.Cardinality.UNARY_UNARY,
@@ -2102,6 +2112,12 @@ class ModalClientStub:
2102
2112
  modal_proto.api_pb2.FlashContainerRegisterRequest,
2103
2113
  modal_proto.api_pb2.FlashContainerRegisterResponse,
2104
2114
  )
2115
+ self.FlashSetTargetSlotsMetrics = grpclib.client.UnaryUnaryMethod(
2116
+ channel,
2117
+ '/modal.client.ModalClient/FlashSetTargetSlotsMetrics',
2118
+ modal_proto.api_pb2.FlashSetTargetSlotsMetricsRequest,
2119
+ modal_proto.api_pb2.FlashSetTargetSlotsMetricsResponse,
2120
+ )
2105
2121
  self.FunctionAsyncInvoke = grpclib.client.UnaryUnaryMethod(
2106
2122
  channel,
2107
2123
  '/modal.client.ModalClient/FunctionAsyncInvoke',