modal 0.67.1__py3-none-any.whl → 0.67.33__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 (113) hide show
  1. modal/_clustered_functions.py +2 -2
  2. modal/_clustered_functions.pyi +2 -2
  3. modal/_container_entrypoint.py +8 -5
  4. modal/_output.py +29 -28
  5. modal/_pty.py +2 -2
  6. modal/_resolver.py +6 -5
  7. modal/_resources.py +3 -3
  8. modal/_runtime/asgi.py +46 -6
  9. modal/_runtime/container_io_manager.py +22 -26
  10. modal/_runtime/execution_context.py +2 -2
  11. modal/_runtime/telemetry.py +1 -2
  12. modal/_runtime/user_code_imports.py +12 -14
  13. modal/_serialization.py +3 -7
  14. modal/_traceback.py +5 -5
  15. modal/_tunnel.py +5 -4
  16. modal/_tunnel.pyi +2 -2
  17. modal/_utils/async_utils.py +53 -17
  18. modal/_utils/blob_utils.py +22 -7
  19. modal/_utils/function_utils.py +20 -10
  20. modal/_utils/grpc_testing.py +7 -6
  21. modal/_utils/grpc_utils.py +2 -3
  22. modal/_utils/hash_utils.py +2 -2
  23. modal/_utils/mount_utils.py +5 -4
  24. modal/_utils/package_utils.py +2 -3
  25. modal/_utils/pattern_matcher.py +6 -6
  26. modal/_utils/rand_pb_testing.py +3 -3
  27. modal/_utils/shell_utils.py +2 -1
  28. modal/_vendor/a2wsgi_wsgi.py +62 -72
  29. modal/_vendor/cloudpickle.py +1 -1
  30. modal/_watcher.py +8 -7
  31. modal/app.py +68 -62
  32. modal/app.pyi +104 -99
  33. modal/call_graph.py +6 -6
  34. modal/cli/_download.py +3 -2
  35. modal/cli/_traceback.py +4 -4
  36. modal/cli/app.py +4 -4
  37. modal/cli/container.py +4 -4
  38. modal/cli/dict.py +1 -1
  39. modal/cli/environment.py +2 -3
  40. modal/cli/import_refs.py +1 -1
  41. modal/cli/launch.py +2 -2
  42. modal/cli/network_file_system.py +1 -1
  43. modal/cli/profile.py +1 -1
  44. modal/cli/programs/run_jupyter.py +2 -2
  45. modal/cli/programs/vscode.py +3 -3
  46. modal/cli/queues.py +1 -1
  47. modal/cli/run.py +6 -6
  48. modal/cli/secret.py +3 -3
  49. modal/cli/utils.py +2 -1
  50. modal/cli/volume.py +3 -3
  51. modal/client.py +6 -11
  52. modal/client.pyi +18 -27
  53. modal/cloud_bucket_mount.py +3 -3
  54. modal/cloud_bucket_mount.pyi +2 -2
  55. modal/cls.py +100 -47
  56. modal/cls.pyi +40 -40
  57. modal/config.py +3 -2
  58. modal/container_process.py +6 -2
  59. modal/dict.py +6 -3
  60. modal/dict.pyi +10 -9
  61. modal/environments.py +3 -3
  62. modal/environments.pyi +3 -3
  63. modal/exception.py +2 -3
  64. modal/functions.py +112 -104
  65. modal/functions.pyi +77 -58
  66. modal/image.py +59 -57
  67. modal/image.pyi +104 -103
  68. modal/io_streams.py +20 -12
  69. modal/io_streams.pyi +24 -14
  70. modal/mount.py +24 -24
  71. modal/mount.pyi +28 -29
  72. modal/network_file_system.py +14 -11
  73. modal/network_file_system.pyi +12 -11
  74. modal/object.py +9 -8
  75. modal/object.pyi +47 -34
  76. modal/output.py +2 -1
  77. modal/parallel_map.py +4 -4
  78. modal/partial_function.py +10 -14
  79. modal/partial_function.pyi +17 -18
  80. modal/queue.py +11 -8
  81. modal/queue.pyi +23 -22
  82. modal/retries.py +38 -0
  83. modal/runner.py +8 -7
  84. modal/runner.pyi +8 -14
  85. modal/running_app.py +3 -3
  86. modal/sandbox.py +20 -13
  87. modal/sandbox.pyi +73 -72
  88. modal/scheduler_placement.py +2 -1
  89. modal/secret.py +7 -7
  90. modal/secret.pyi +12 -12
  91. modal/serving.py +4 -3
  92. modal/serving.pyi +5 -4
  93. modal/token_flow.py +3 -2
  94. modal/token_flow.pyi +3 -3
  95. modal/volume.py +16 -23
  96. modal/volume.pyi +17 -16
  97. {modal-0.67.1.dist-info → modal-0.67.33.dist-info}/METADATA +2 -2
  98. modal-0.67.33.dist-info/RECORD +168 -0
  99. modal_docs/mdmd/signatures.py +1 -2
  100. modal_global_objects/mounts/python_standalone.py +1 -1
  101. modal_proto/api.proto +15 -0
  102. modal_proto/api_grpc.py +32 -0
  103. modal_proto/api_pb2.py +674 -654
  104. modal_proto/api_pb2.pyi +45 -1
  105. modal_proto/api_pb2_grpc.py +66 -0
  106. modal_proto/api_pb2_grpc.pyi +20 -0
  107. modal_proto/modal_api_grpc.py +2 -0
  108. modal_version/_version_generated.py +1 -1
  109. modal-0.67.1.dist-info/RECORD +0 -168
  110. {modal-0.67.1.dist-info → modal-0.67.33.dist-info}/LICENSE +0 -0
  111. {modal-0.67.1.dist-info → modal-0.67.33.dist-info}/WHEEL +0 -0
  112. {modal-0.67.1.dist-info → modal-0.67.33.dist-info}/entry_points.txt +0 -0
  113. {modal-0.67.1.dist-info → modal-0.67.33.dist-info}/top_level.txt +0 -0
@@ -4,12 +4,11 @@ import inspect
4
4
  import re
5
5
  import textwrap
6
6
  import warnings
7
- from typing import Tuple
8
7
 
9
8
  from synchronicity.synchronizer import FunctionWithAio
10
9
 
11
10
 
12
- def _signature_from_ast(func) -> Tuple[str, str]:
11
+ def _signature_from_ast(func) -> tuple[str, str]:
13
12
  """Get function signature, including decorators and comments, from source code
14
13
 
15
14
  Traverses functools.wraps-wrappings to get source of underlying function.
@@ -17,7 +17,7 @@ def publish_python_standalone_mount(client, version: str) -> None:
17
17
  release, full_version = PYTHON_STANDALONE_VERSIONS[version]
18
18
 
19
19
  libc = "gnu"
20
- arch = "x86_64" if version == "3.8" else "x86_64_v3"
20
+ arch = "x86_64_v3"
21
21
  url = (
22
22
  "https://github.com/indygreg/python-build-standalone/releases/download"
23
23
  + f"/{release}/cpython-{full_version}+{release}-{arch}-unknown-linux-gnu-install_only.tar.gz"
modal_proto/api.proto CHANGED
@@ -589,6 +589,7 @@ message CheckpointInfo {
589
589
  string runtime_fingerprint = 4;
590
590
  int64 size = 5;
591
591
  bool checksum_is_file_index = 6;
592
+ string original_task_id = 7;
592
593
  }
593
594
 
594
595
  message ClassCreateRequest {
@@ -2146,6 +2147,18 @@ message SandboxListResponse {
2146
2147
  repeated SandboxInfo sandboxes = 1;
2147
2148
  }
2148
2149
 
2150
+ message SandboxSnapshotFsRequest {
2151
+ string sandbox_id = 1;
2152
+ float timeout = 2;
2153
+ }
2154
+
2155
+ message SandboxSnapshotFsResponse {
2156
+ string image_id = 1;
2157
+ GenericResult result = 2;
2158
+ // Metadata may be empty since we may skip it for performance reasons.
2159
+ ImageMetadata image_metadata = 3;
2160
+ }
2161
+
2149
2162
  message SandboxStdinWriteRequest {
2150
2163
  string sandbox_id = 1;
2151
2164
  bytes input = 2;
@@ -2662,6 +2675,7 @@ service ModalClient {
2662
2675
  rpc ContainerFilesystemExec(ContainerFilesystemExecRequest) returns (ContainerFilesystemExecResponse);
2663
2676
  rpc ContainerFilesystemExecGetOutput(ContainerFilesystemExecGetOutputRequest) returns (stream FilesystemRuntimeOutputBatch);
2664
2677
  rpc ContainerHeartbeat(ContainerHeartbeatRequest) returns (ContainerHeartbeatResponse);
2678
+ rpc ContainerHello(google.protobuf.Empty) returns (google.protobuf.Empty);
2665
2679
  rpc ContainerLog(ContainerLogRequest) returns (google.protobuf.Empty);
2666
2680
  rpc ContainerStop(ContainerStopRequest) returns (ContainerStopResponse);
2667
2681
 
@@ -2745,6 +2759,7 @@ service ModalClient {
2745
2759
  rpc SandboxGetTaskId(SandboxGetTaskIdRequest) returns (SandboxGetTaskIdResponse); // needed for modal container exec
2746
2760
  rpc SandboxGetTunnels(SandboxGetTunnelsRequest) returns (SandboxGetTunnelsResponse);
2747
2761
  rpc SandboxList(SandboxListRequest) returns (SandboxListResponse);
2762
+ rpc SandboxSnapshotFs(SandboxSnapshotFsRequest) returns (SandboxSnapshotFsResponse);
2748
2763
  rpc SandboxStdinWrite(SandboxStdinWriteRequest) returns (SandboxStdinWriteResponse);
2749
2764
  rpc SandboxTagsSet(SandboxTagsSetRequest) returns (google.protobuf.Empty);
2750
2765
  rpc SandboxTerminate(SandboxTerminateRequest) returns (SandboxTerminateResponse);
modal_proto/api_grpc.py CHANGED
@@ -129,6 +129,10 @@ class ModalClientBase(abc.ABC):
129
129
  async def ContainerHeartbeat(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.ContainerHeartbeatRequest, modal_proto.api_pb2.ContainerHeartbeatResponse]') -> None:
130
130
  pass
131
131
 
132
+ @abc.abstractmethod
133
+ async def ContainerHello(self, stream: 'grpclib.server.Stream[google.protobuf.empty_pb2.Empty, google.protobuf.empty_pb2.Empty]') -> None:
134
+ pass
135
+
132
136
  @abc.abstractmethod
133
137
  async def ContainerLog(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.ContainerLogRequest, google.protobuf.empty_pb2.Empty]') -> None:
134
138
  pass
@@ -389,6 +393,10 @@ class ModalClientBase(abc.ABC):
389
393
  async def SandboxList(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.SandboxListRequest, modal_proto.api_pb2.SandboxListResponse]') -> None:
390
394
  pass
391
395
 
396
+ @abc.abstractmethod
397
+ async def SandboxSnapshotFs(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.SandboxSnapshotFsRequest, modal_proto.api_pb2.SandboxSnapshotFsResponse]') -> None:
398
+ pass
399
+
392
400
  @abc.abstractmethod
393
401
  async def SandboxStdinWrite(self, stream: 'grpclib.server.Stream[modal_proto.api_pb2.SandboxStdinWriteRequest, modal_proto.api_pb2.SandboxStdinWriteResponse]') -> None:
394
402
  pass
@@ -703,6 +711,12 @@ class ModalClientBase(abc.ABC):
703
711
  modal_proto.api_pb2.ContainerHeartbeatRequest,
704
712
  modal_proto.api_pb2.ContainerHeartbeatResponse,
705
713
  ),
714
+ '/modal.client.ModalClient/ContainerHello': grpclib.const.Handler(
715
+ self.ContainerHello,
716
+ grpclib.const.Cardinality.UNARY_UNARY,
717
+ google.protobuf.empty_pb2.Empty,
718
+ google.protobuf.empty_pb2.Empty,
719
+ ),
706
720
  '/modal.client.ModalClient/ContainerLog': grpclib.const.Handler(
707
721
  self.ContainerLog,
708
722
  grpclib.const.Cardinality.UNARY_UNARY,
@@ -1093,6 +1107,12 @@ class ModalClientBase(abc.ABC):
1093
1107
  modal_proto.api_pb2.SandboxListRequest,
1094
1108
  modal_proto.api_pb2.SandboxListResponse,
1095
1109
  ),
1110
+ '/modal.client.ModalClient/SandboxSnapshotFs': grpclib.const.Handler(
1111
+ self.SandboxSnapshotFs,
1112
+ grpclib.const.Cardinality.UNARY_UNARY,
1113
+ modal_proto.api_pb2.SandboxSnapshotFsRequest,
1114
+ modal_proto.api_pb2.SandboxSnapshotFsResponse,
1115
+ ),
1096
1116
  '/modal.client.ModalClient/SandboxStdinWrite': grpclib.const.Handler(
1097
1117
  self.SandboxStdinWrite,
1098
1118
  grpclib.const.Cardinality.UNARY_UNARY,
@@ -1483,6 +1503,12 @@ class ModalClientStub:
1483
1503
  modal_proto.api_pb2.ContainerHeartbeatRequest,
1484
1504
  modal_proto.api_pb2.ContainerHeartbeatResponse,
1485
1505
  )
1506
+ self.ContainerHello = grpclib.client.UnaryUnaryMethod(
1507
+ channel,
1508
+ '/modal.client.ModalClient/ContainerHello',
1509
+ google.protobuf.empty_pb2.Empty,
1510
+ google.protobuf.empty_pb2.Empty,
1511
+ )
1486
1512
  self.ContainerLog = grpclib.client.UnaryUnaryMethod(
1487
1513
  channel,
1488
1514
  '/modal.client.ModalClient/ContainerLog',
@@ -1873,6 +1899,12 @@ class ModalClientStub:
1873
1899
  modal_proto.api_pb2.SandboxListRequest,
1874
1900
  modal_proto.api_pb2.SandboxListResponse,
1875
1901
  )
1902
+ self.SandboxSnapshotFs = grpclib.client.UnaryUnaryMethod(
1903
+ channel,
1904
+ '/modal.client.ModalClient/SandboxSnapshotFs',
1905
+ modal_proto.api_pb2.SandboxSnapshotFsRequest,
1906
+ modal_proto.api_pb2.SandboxSnapshotFsResponse,
1907
+ )
1876
1908
  self.SandboxStdinWrite = grpclib.client.UnaryUnaryMethod(
1877
1909
  channel,
1878
1910
  '/modal.client.ModalClient/SandboxStdinWrite',