modal 1.2.1.dev8__py3-none-any.whl → 1.2.2.dev19__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 (70) hide show
  1. modal/_clustered_functions.py +1 -3
  2. modal/_container_entrypoint.py +4 -1
  3. modal/_functions.py +33 -49
  4. modal/_grpc_client.py +148 -0
  5. modal/_output.py +3 -4
  6. modal/_partial_function.py +22 -2
  7. modal/_runtime/container_io_manager.py +21 -22
  8. modal/_utils/async_utils.py +12 -3
  9. modal/_utils/auth_token_manager.py +1 -4
  10. modal/_utils/blob_utils.py +3 -4
  11. modal/_utils/function_utils.py +4 -0
  12. modal/_utils/grpc_utils.py +80 -51
  13. modal/_utils/mount_utils.py +26 -1
  14. modal/_utils/task_command_router_client.py +536 -0
  15. modal/app.py +7 -5
  16. modal/cli/cluster.py +4 -2
  17. modal/cli/config.py +3 -1
  18. modal/cli/container.py +5 -4
  19. modal/cli/entry_point.py +1 -0
  20. modal/cli/launch.py +1 -2
  21. modal/cli/network_file_system.py +1 -4
  22. modal/cli/queues.py +1 -2
  23. modal/cli/secret.py +1 -2
  24. modal/client.py +5 -115
  25. modal/client.pyi +2 -91
  26. modal/cls.py +1 -2
  27. modal/config.py +3 -1
  28. modal/container_process.py +287 -11
  29. modal/container_process.pyi +95 -32
  30. modal/dict.py +12 -12
  31. modal/environments.py +1 -2
  32. modal/exception.py +4 -0
  33. modal/experimental/__init__.py +2 -3
  34. modal/experimental/flash.py +27 -57
  35. modal/experimental/flash.pyi +6 -20
  36. modal/file_io.py +13 -27
  37. modal/functions.pyi +6 -6
  38. modal/image.py +24 -3
  39. modal/image.pyi +4 -0
  40. modal/io_streams.py +433 -127
  41. modal/io_streams.pyi +236 -171
  42. modal/mount.py +4 -4
  43. modal/network_file_system.py +5 -6
  44. modal/parallel_map.py +29 -31
  45. modal/parallel_map.pyi +3 -9
  46. modal/partial_function.pyi +4 -1
  47. modal/queue.py +17 -18
  48. modal/runner.py +12 -11
  49. modal/sandbox.py +148 -42
  50. modal/sandbox.pyi +139 -0
  51. modal/secret.py +4 -5
  52. modal/snapshot.py +1 -4
  53. modal/token_flow.py +1 -1
  54. modal/volume.py +22 -22
  55. {modal-1.2.1.dev8.dist-info → modal-1.2.2.dev19.dist-info}/METADATA +1 -1
  56. {modal-1.2.1.dev8.dist-info → modal-1.2.2.dev19.dist-info}/RECORD +70 -68
  57. modal_proto/api.proto +2 -24
  58. modal_proto/api_grpc.py +0 -32
  59. modal_proto/api_pb2.py +838 -878
  60. modal_proto/api_pb2.pyi +8 -70
  61. modal_proto/api_pb2_grpc.py +0 -67
  62. modal_proto/api_pb2_grpc.pyi +0 -22
  63. modal_proto/modal_api_grpc.py +175 -177
  64. modal_proto/sandbox_router.proto +0 -4
  65. modal_proto/sandbox_router_pb2.pyi +0 -4
  66. modal_version/__init__.py +1 -1
  67. {modal-1.2.1.dev8.dist-info → modal-1.2.2.dev19.dist-info}/WHEEL +0 -0
  68. {modal-1.2.1.dev8.dist-info → modal-1.2.2.dev19.dist-info}/entry_points.txt +0 -0
  69. {modal-1.2.1.dev8.dist-info → modal-1.2.2.dev19.dist-info}/licenses/LICENSE +0 -0
  70. {modal-1.2.1.dev8.dist-info → modal-1.2.2.dev19.dist-info}/top_level.txt +0 -0
modal_proto/api_pb2.pyi CHANGED
@@ -2735,6 +2735,7 @@ class CloudBucketMount(google.protobuf.message.Message):
2735
2735
  BUCKET_ENDPOINT_URL_FIELD_NUMBER: builtins.int
2736
2736
  KEY_PREFIX_FIELD_NUMBER: builtins.int
2737
2737
  OIDC_AUTH_ROLE_ARN_FIELD_NUMBER: builtins.int
2738
+ FORCE_PATH_STYLE_FIELD_NUMBER: builtins.int
2738
2739
  bucket_name: builtins.str
2739
2740
  mount_path: builtins.str
2740
2741
  credentials_secret_id: builtins.str
@@ -2744,6 +2745,7 @@ class CloudBucketMount(google.protobuf.message.Message):
2744
2745
  bucket_endpoint_url: builtins.str
2745
2746
  key_prefix: builtins.str
2746
2747
  oidc_auth_role_arn: builtins.str
2748
+ force_path_style: builtins.bool
2747
2749
  def __init__(
2748
2750
  self,
2749
2751
  *,
@@ -2756,9 +2758,10 @@ class CloudBucketMount(google.protobuf.message.Message):
2756
2758
  bucket_endpoint_url: builtins.str | None = ...,
2757
2759
  key_prefix: builtins.str | None = ...,
2758
2760
  oidc_auth_role_arn: builtins.str | None = ...,
2761
+ force_path_style: builtins.bool = ...,
2759
2762
  ) -> None: ...
2760
2763
  def HasField(self, field_name: typing_extensions.Literal["_bucket_endpoint_url", b"_bucket_endpoint_url", "_key_prefix", b"_key_prefix", "_oidc_auth_role_arn", b"_oidc_auth_role_arn", "bucket_endpoint_url", b"bucket_endpoint_url", "key_prefix", b"key_prefix", "oidc_auth_role_arn", b"oidc_auth_role_arn"]) -> builtins.bool: ...
2761
- def ClearField(self, field_name: typing_extensions.Literal["_bucket_endpoint_url", b"_bucket_endpoint_url", "_key_prefix", b"_key_prefix", "_oidc_auth_role_arn", b"_oidc_auth_role_arn", "bucket_endpoint_url", b"bucket_endpoint_url", "bucket_name", b"bucket_name", "bucket_type", b"bucket_type", "credentials_secret_id", b"credentials_secret_id", "key_prefix", b"key_prefix", "mount_path", b"mount_path", "oidc_auth_role_arn", b"oidc_auth_role_arn", "read_only", b"read_only", "requester_pays", b"requester_pays"]) -> None: ...
2764
+ def ClearField(self, field_name: typing_extensions.Literal["_bucket_endpoint_url", b"_bucket_endpoint_url", "_key_prefix", b"_key_prefix", "_oidc_auth_role_arn", b"_oidc_auth_role_arn", "bucket_endpoint_url", b"bucket_endpoint_url", "bucket_name", b"bucket_name", "bucket_type", b"bucket_type", "credentials_secret_id", b"credentials_secret_id", "force_path_style", b"force_path_style", "key_prefix", b"key_prefix", "mount_path", b"mount_path", "oidc_auth_role_arn", b"oidc_auth_role_arn", "read_only", b"read_only", "requester_pays", b"requester_pays"]) -> None: ...
2762
2765
  @typing.overload
2763
2766
  def WhichOneof(self, oneof_group: typing_extensions.Literal["_bucket_endpoint_url", b"_bucket_endpoint_url"]) -> typing_extensions.Literal["bucket_endpoint_url"] | None: ...
2764
2767
  @typing.overload
@@ -7990,15 +7993,18 @@ class ProxyCreateRequest(google.protobuf.message.Message):
7990
7993
 
7991
7994
  NAME_FIELD_NUMBER: builtins.int
7992
7995
  ENVIRONMENT_NAME_FIELD_NUMBER: builtins.int
7996
+ REGION_FIELD_NUMBER: builtins.int
7993
7997
  name: builtins.str
7994
7998
  environment_name: builtins.str
7999
+ region: builtins.str
7995
8000
  def __init__(
7996
8001
  self,
7997
8002
  *,
7998
8003
  name: builtins.str = ...,
7999
8004
  environment_name: builtins.str = ...,
8005
+ region: builtins.str = ...,
8000
8006
  ) -> None: ...
8001
- def ClearField(self, field_name: typing_extensions.Literal["environment_name", b"environment_name", "name", b"name"]) -> None: ...
8007
+ def ClearField(self, field_name: typing_extensions.Literal["environment_name", b"environment_name", "name", b"name", "region", b"region"]) -> None: ...
8002
8008
 
8003
8009
  global___ProxyCreateRequest = ProxyCreateRequest
8004
8010
 
@@ -8917,44 +8923,6 @@ class SandboxCreateResponse(google.protobuf.message.Message):
8917
8923
 
8918
8924
  global___SandboxCreateResponse = SandboxCreateResponse
8919
8925
 
8920
- class SandboxGetCommandRouterAccessRequest(google.protobuf.message.Message):
8921
- """Used to get a JWT and URL for direct access to a sandbox router server
8922
- running on the modal-worker, so the client can issue exec commands (and other
8923
- operations as they become available) directly to the worker.
8924
- DEPRECATED: Use TaskGetCommandRouterAccessRequest instead.
8925
- TODO(saltzm): Remove this.
8926
- """
8927
-
8928
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
8929
-
8930
- SANDBOX_ID_FIELD_NUMBER: builtins.int
8931
- sandbox_id: builtins.str
8932
- def __init__(
8933
- self,
8934
- *,
8935
- sandbox_id: builtins.str = ...,
8936
- ) -> None: ...
8937
- def ClearField(self, field_name: typing_extensions.Literal["sandbox_id", b"sandbox_id"]) -> None: ...
8938
-
8939
- global___SandboxGetCommandRouterAccessRequest = SandboxGetCommandRouterAccessRequest
8940
-
8941
- class SandboxGetCommandRouterAccessResponse(google.protobuf.message.Message):
8942
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
8943
-
8944
- JWT_FIELD_NUMBER: builtins.int
8945
- URL_FIELD_NUMBER: builtins.int
8946
- jwt: builtins.str
8947
- url: builtins.str
8948
- def __init__(
8949
- self,
8950
- *,
8951
- jwt: builtins.str = ...,
8952
- url: builtins.str = ...,
8953
- ) -> None: ...
8954
- def ClearField(self, field_name: typing_extensions.Literal["jwt", b"jwt", "url", b"url"]) -> None: ...
8955
-
8956
- global___SandboxGetCommandRouterAccessResponse = SandboxGetCommandRouterAccessResponse
8957
-
8958
8926
  class SandboxGetFromNameRequest(google.protobuf.message.Message):
8959
8927
  DESCRIPTOR: google.protobuf.descriptor.Descriptor
8960
8928
 
@@ -10302,36 +10270,6 @@ class TaskCurrentInputsResponse(google.protobuf.message.Message):
10302
10270
 
10303
10271
  global___TaskCurrentInputsResponse = TaskCurrentInputsResponse
10304
10272
 
10305
- class TaskGetAutoscalingMetricsRequest(google.protobuf.message.Message):
10306
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
10307
-
10308
- TASK_ID_FIELD_NUMBER: builtins.int
10309
- task_id: builtins.str
10310
- def __init__(
10311
- self,
10312
- *,
10313
- task_id: builtins.str = ...,
10314
- ) -> None: ...
10315
- def ClearField(self, field_name: typing_extensions.Literal["task_id", b"task_id"]) -> None: ...
10316
-
10317
- global___TaskGetAutoscalingMetricsRequest = TaskGetAutoscalingMetricsRequest
10318
-
10319
- class TaskGetAutoscalingMetricsResponse(google.protobuf.message.Message):
10320
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
10321
-
10322
- METRICS_FIELD_NUMBER: builtins.int
10323
- @property
10324
- def metrics(self) -> global___AutoscalingMetrics: ...
10325
- def __init__(
10326
- self,
10327
- *,
10328
- metrics: global___AutoscalingMetrics | None = ...,
10329
- ) -> None: ...
10330
- def HasField(self, field_name: typing_extensions.Literal["metrics", b"metrics"]) -> builtins.bool: ...
10331
- def ClearField(self, field_name: typing_extensions.Literal["metrics", b"metrics"]) -> None: ...
10332
-
10333
- global___TaskGetAutoscalingMetricsResponse = TaskGetAutoscalingMetricsResponse
10334
-
10335
10273
  class TaskGetCommandRouterAccessRequest(google.protobuf.message.Message):
10336
10274
  """Used to get a JWT and URL for direct access to a task command router
10337
10275
  running on the modal-worker, so the client can issue exec commands (and other
@@ -595,11 +595,6 @@ class ModalClientStub(object):
595
595
  request_serializer=modal__proto_dot_api__pb2.SandboxCreateConnectTokenRequest.SerializeToString,
596
596
  response_deserializer=modal__proto_dot_api__pb2.SandboxCreateConnectTokenResponse.FromString,
597
597
  )
598
- self.SandboxGetCommandRouterAccess = channel.unary_unary(
599
- '/modal.client.ModalClient/SandboxGetCommandRouterAccess',
600
- request_serializer=modal__proto_dot_api__pb2.SandboxGetCommandRouterAccessRequest.SerializeToString,
601
- response_deserializer=modal__proto_dot_api__pb2.SandboxGetCommandRouterAccessResponse.FromString,
602
- )
603
598
  self.SandboxGetFromName = channel.unary_unary(
604
599
  '/modal.client.ModalClient/SandboxGetFromName',
605
600
  request_serializer=modal__proto_dot_api__pb2.SandboxGetFromNameRequest.SerializeToString,
@@ -760,11 +755,6 @@ class ModalClientStub(object):
760
755
  request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
761
756
  response_deserializer=modal__proto_dot_api__pb2.TaskCurrentInputsResponse.FromString,
762
757
  )
763
- self.TaskGetAutoscalingMetrics = channel.unary_unary(
764
- '/modal.client.ModalClient/TaskGetAutoscalingMetrics',
765
- request_serializer=modal__proto_dot_api__pb2.TaskGetAutoscalingMetricsRequest.SerializeToString,
766
- response_deserializer=modal__proto_dot_api__pb2.TaskGetAutoscalingMetricsResponse.FromString,
767
- )
768
758
  self.TaskGetCommandRouterAccess = channel.unary_unary(
769
759
  '/modal.client.ModalClient/TaskGetCommandRouterAccess',
770
760
  request_serializer=modal__proto_dot_api__pb2.TaskGetCommandRouterAccessRequest.SerializeToString,
@@ -1620,12 +1610,6 @@ class ModalClientServicer(object):
1620
1610
  context.set_details('Method not implemented!')
1621
1611
  raise NotImplementedError('Method not implemented!')
1622
1612
 
1623
- def SandboxGetCommandRouterAccess(self, request, context):
1624
- """Missing associated documentation comment in .proto file."""
1625
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
1626
- context.set_details('Method not implemented!')
1627
- raise NotImplementedError('Method not implemented!')
1628
-
1629
1613
  def SandboxGetFromName(self, request, context):
1630
1614
  """Missing associated documentation comment in .proto file."""
1631
1615
  context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -1822,13 +1806,6 @@ class ModalClientServicer(object):
1822
1806
  context.set_details('Method not implemented!')
1823
1807
  raise NotImplementedError('Method not implemented!')
1824
1808
 
1825
- def TaskGetAutoscalingMetrics(self, request, context):
1826
- """Used for flash autoscaling
1827
- """
1828
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
1829
- context.set_details('Method not implemented!')
1830
- raise NotImplementedError('Method not implemented!')
1831
-
1832
1809
  def TaskGetCommandRouterAccess(self, request, context):
1833
1810
  """Missing associated documentation comment in .proto file."""
1834
1811
  context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -2572,11 +2549,6 @@ def add_ModalClientServicer_to_server(servicer, server):
2572
2549
  request_deserializer=modal__proto_dot_api__pb2.SandboxCreateConnectTokenRequest.FromString,
2573
2550
  response_serializer=modal__proto_dot_api__pb2.SandboxCreateConnectTokenResponse.SerializeToString,
2574
2551
  ),
2575
- 'SandboxGetCommandRouterAccess': grpc.unary_unary_rpc_method_handler(
2576
- servicer.SandboxGetCommandRouterAccess,
2577
- request_deserializer=modal__proto_dot_api__pb2.SandboxGetCommandRouterAccessRequest.FromString,
2578
- response_serializer=modal__proto_dot_api__pb2.SandboxGetCommandRouterAccessResponse.SerializeToString,
2579
- ),
2580
2552
  'SandboxGetFromName': grpc.unary_unary_rpc_method_handler(
2581
2553
  servicer.SandboxGetFromName,
2582
2554
  request_deserializer=modal__proto_dot_api__pb2.SandboxGetFromNameRequest.FromString,
@@ -2737,11 +2709,6 @@ def add_ModalClientServicer_to_server(servicer, server):
2737
2709
  request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
2738
2710
  response_serializer=modal__proto_dot_api__pb2.TaskCurrentInputsResponse.SerializeToString,
2739
2711
  ),
2740
- 'TaskGetAutoscalingMetrics': grpc.unary_unary_rpc_method_handler(
2741
- servicer.TaskGetAutoscalingMetrics,
2742
- request_deserializer=modal__proto_dot_api__pb2.TaskGetAutoscalingMetricsRequest.FromString,
2743
- response_serializer=modal__proto_dot_api__pb2.TaskGetAutoscalingMetricsResponse.SerializeToString,
2744
- ),
2745
2712
  'TaskGetCommandRouterAccess': grpc.unary_unary_rpc_method_handler(
2746
2713
  servicer.TaskGetCommandRouterAccess,
2747
2714
  request_deserializer=modal__proto_dot_api__pb2.TaskGetCommandRouterAccessRequest.FromString,
@@ -4854,23 +4821,6 @@ class ModalClient(object):
4854
4821
  options, channel_credentials,
4855
4822
  insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
4856
4823
 
4857
- @staticmethod
4858
- def SandboxGetCommandRouterAccess(request,
4859
- target,
4860
- options=(),
4861
- channel_credentials=None,
4862
- call_credentials=None,
4863
- insecure=False,
4864
- compression=None,
4865
- wait_for_ready=None,
4866
- timeout=None,
4867
- metadata=None):
4868
- return grpc.experimental.unary_unary(request, target, '/modal.client.ModalClient/SandboxGetCommandRouterAccess',
4869
- modal__proto_dot_api__pb2.SandboxGetCommandRouterAccessRequest.SerializeToString,
4870
- modal__proto_dot_api__pb2.SandboxGetCommandRouterAccessResponse.FromString,
4871
- options, channel_credentials,
4872
- insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
4873
-
4874
4824
  @staticmethod
4875
4825
  def SandboxGetFromName(request,
4876
4826
  target,
@@ -5415,23 +5365,6 @@ class ModalClient(object):
5415
5365
  options, channel_credentials,
5416
5366
  insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
5417
5367
 
5418
- @staticmethod
5419
- def TaskGetAutoscalingMetrics(request,
5420
- target,
5421
- options=(),
5422
- channel_credentials=None,
5423
- call_credentials=None,
5424
- insecure=False,
5425
- compression=None,
5426
- wait_for_ready=None,
5427
- timeout=None,
5428
- metadata=None):
5429
- return grpc.experimental.unary_unary(request, target, '/modal.client.ModalClient/TaskGetAutoscalingMetrics',
5430
- modal__proto_dot_api__pb2.TaskGetAutoscalingMetricsRequest.SerializeToString,
5431
- modal__proto_dot_api__pb2.TaskGetAutoscalingMetricsResponse.FromString,
5432
- options, channel_credentials,
5433
- insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
5434
-
5435
5368
  @staticmethod
5436
5369
  def TaskGetCommandRouterAccess(request,
5437
5370
  target,
@@ -498,10 +498,6 @@ class ModalClientStub:
498
498
  modal_proto.api_pb2.SandboxCreateConnectTokenRequest,
499
499
  modal_proto.api_pb2.SandboxCreateConnectTokenResponse,
500
500
  ]
501
- SandboxGetCommandRouterAccess: grpc.UnaryUnaryMultiCallable[
502
- modal_proto.api_pb2.SandboxGetCommandRouterAccessRequest,
503
- modal_proto.api_pb2.SandboxGetCommandRouterAccessResponse,
504
- ]
505
501
  SandboxGetFromName: grpc.UnaryUnaryMultiCallable[
506
502
  modal_proto.api_pb2.SandboxGetFromNameRequest,
507
503
  modal_proto.api_pb2.SandboxGetFromNameResponse,
@@ -634,11 +630,6 @@ class ModalClientStub:
634
630
  google.protobuf.empty_pb2.Empty,
635
631
  modal_proto.api_pb2.TaskCurrentInputsResponse,
636
632
  ]
637
- TaskGetAutoscalingMetrics: grpc.UnaryUnaryMultiCallable[
638
- modal_proto.api_pb2.TaskGetAutoscalingMetricsRequest,
639
- modal_proto.api_pb2.TaskGetAutoscalingMetricsResponse,
640
- ]
641
- """Used for flash autoscaling"""
642
633
  TaskGetCommandRouterAccess: grpc.UnaryUnaryMultiCallable[
643
634
  modal_proto.api_pb2.TaskGetCommandRouterAccessRequest,
644
635
  modal_proto.api_pb2.TaskGetCommandRouterAccessResponse,
@@ -1470,12 +1461,6 @@ class ModalClientServicer(metaclass=abc.ABCMeta):
1470
1461
  context: grpc.ServicerContext,
1471
1462
  ) -> modal_proto.api_pb2.SandboxCreateConnectTokenResponse: ...
1472
1463
  @abc.abstractmethod
1473
- def SandboxGetCommandRouterAccess(
1474
- self,
1475
- request: modal_proto.api_pb2.SandboxGetCommandRouterAccessRequest,
1476
- context: grpc.ServicerContext,
1477
- ) -> modal_proto.api_pb2.SandboxGetCommandRouterAccessResponse: ...
1478
- @abc.abstractmethod
1479
1464
  def SandboxGetFromName(
1480
1465
  self,
1481
1466
  request: modal_proto.api_pb2.SandboxGetFromNameRequest,
@@ -1672,13 +1657,6 @@ class ModalClientServicer(metaclass=abc.ABCMeta):
1672
1657
  context: grpc.ServicerContext,
1673
1658
  ) -> modal_proto.api_pb2.TaskCurrentInputsResponse: ...
1674
1659
  @abc.abstractmethod
1675
- def TaskGetAutoscalingMetrics(
1676
- self,
1677
- request: modal_proto.api_pb2.TaskGetAutoscalingMetricsRequest,
1678
- context: grpc.ServicerContext,
1679
- ) -> modal_proto.api_pb2.TaskGetAutoscalingMetricsResponse:
1680
- """Used for flash autoscaling"""
1681
- @abc.abstractmethod
1682
1660
  def TaskGetCommandRouterAccess(
1683
1661
  self,
1684
1662
  request: modal_proto.api_pb2.TaskGetCommandRouterAccessRequest,