modal 1.6.4.dev15__tar.gz → 1.6.4.dev17__tar.gz
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.
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/PKG-INFO +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/__main__.py +2 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_cluster.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_environments.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_functions.py +5 -6
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_image.py +3 -3
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_object.py +17 -11
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_output/manager.py +4 -3
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_output/rich.py +18 -5
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/task_lifecycle_manager.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/async_utils.py +23 -5
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/auth_token_manager.py +17 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/http_utils.py +9 -3
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_workspace.py +57 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/app.py +68 -10
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/app.pyi +164 -18
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/_help.py +107 -15
- modal-1.6.4.dev17/modal/cli/_suggest.py +155 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/app.py +221 -2
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/function.py +1 -13
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/image.py +46 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/import_refs.py +7 -4
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/run.py +66 -26
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/shell.py +2 -16
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/utils.py +60 -2
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/workspace.py +96 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/client.py +74 -27
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/client.pyi +45 -14
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cls.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/config.py +14 -3
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/dict.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/functions.pyi +7 -7
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/image.pyi +2 -2
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/mount.py +2 -2
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/network_file_system.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/object.pyi +3 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/proxy.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/queue.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_impl_persistent.py +11 -2
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_sandbox.py +65 -3
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_snapshot.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/sandbox.pyi +107 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/secret.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/types.py +187 -5
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/volume.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/workspace.pyi +104 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal.egg-info/PKG-INFO +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal.egg-info/SOURCES.txt +1 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/api_grpc.py +48 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/api_pb2.py +1647 -1542
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/api_pb2.pyi +260 -19
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/api_pb2_grpc.py +99 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/api_pb2_grpc.pyi +30 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/modal_api_grpc.py +3 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_version/__init__.py +1 -1
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/LICENSE +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/README.md +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_audit_logs/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_audit_logs/_rpcs.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_audit_logs/count.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_audit_logs/list.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_billing.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_cluster.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_container_entrypoint.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_function_variants.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_grpc_client.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_ipython.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_load_context.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_location.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_logs.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_logs_manager.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_logs_manager.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_metrics.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_metrics.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_outbound_policy.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_outbound_policy.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_output/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_output/pty.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_output/status.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_partial_function.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_resolver.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_resources.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/asgi.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/container_io_manager.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/container_io_manager.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/execution_context.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/execution_context.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/gpu_memory_snapshot.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/task_lifecycle_manager.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/telemetry.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/user_code_event_loop.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_runtime/user_code_imports.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_serialization.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_server.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_server.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_supports_logs.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_traceback.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_tunnel.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_tunnel.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_type_manager.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/app_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/blob_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/browser_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/bytes_io_segment_payload.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/curl_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/deprecation.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/display_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/docker_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/function_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/git_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/grpc_testing.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/grpc_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/hash_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/idle_countdown.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/jwt_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/logger.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/mount_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/name_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/oauth.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/package_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/pattern_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/proxy_support.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/rand_pb_testing.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/sandbox_fs_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/shell_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_utils/time_utils.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_vendor/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_vendor/a2wsgi_wsgi.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_vendor/cloudpickle.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_vendor/tblib.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_vendor/version.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/_watcher.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/billing.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/billing.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/2023.12.312.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/2023.12.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/2024.04.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/2024.10.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/2025.06.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/2026.10.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/PREVIEW.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/README.md +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/builder/base-images.json +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/call_graph.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/_download.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/_logs.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/_stats.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/_traceback.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/billing.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/changelog.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/config.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/container.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/curl.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/dashboard.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/dict.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/endpoint.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/entry_point.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/environment.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/logo.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/network_file_system.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/profile.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/queues.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/secret.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/selector.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/server.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/skills.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/token.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cli/volume.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cloud_bucket_mount.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cloud_bucket_mount.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cls.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cluster.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/cluster.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/container_process.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/container_process.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/dict.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/environments.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/environments.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/exception.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/_flash_container_entry.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/flash.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/flash.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/flash_server.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/flash_server.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/ipython.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/stream.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/experimental/stream.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/file_pattern_matcher.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/functions.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/image.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/io_streams.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/io_streams.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/mount.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/network_file_system.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/object.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/output.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/parallel_map.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/parallel_map.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/partial_function.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/partial_function.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/proxy.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/py.typed +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/queue.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/retries.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/runner.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/runner.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/running_app.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_common.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_filesystem.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_impl_v1.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_impl_v2.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_sidecar.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/_task_command_router_client.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/sandbox/sandbox.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/schedule.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/scheduler_placement.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/secret.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/server.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/server.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/serving.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/serving.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/skills/modal/SKILL.md +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/stream_type.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/token_flow.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/token_flow.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/volume.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal/workspace.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal.egg-info/dependency_links.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal.egg-info/entry_points.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal.egg-info/requires.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal.egg-info/top_level.txt +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/gen_cli_docs.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/gen_cli_docs_main.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/gen_reference_docs.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/gen_reference_docs_main.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/mdmd/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/mdmd/mdmd.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/mdmd/signatures.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/mdmd/types.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_docs/reference_intro.md +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/__init__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/py.typed +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/task_command_router_grpc.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/task_command_router_pb2.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/task_command_router_pb2.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/task_command_router_pb2_grpc.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_proto/task_command_router_pb2_grpc.pyi +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/modal_version/__main__.py +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/pyproject.toml +0 -0
- {modal-1.6.4.dev15 → modal-1.6.4.dev17}/setup.cfg +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
4
|
from ._traceback import reduce_traceback_to_user_code
|
|
5
|
+
from .cli._suggest import get_hint
|
|
5
6
|
from .cli._traceback import highlight_modal_warnings, setup_rich_traceback
|
|
6
7
|
from .cli.entry_point import entrypoint_cli
|
|
7
8
|
from .cli.import_refs import _CliUserExecutionError
|
|
@@ -41,7 +42,7 @@ def main():
|
|
|
41
42
|
if notes := getattr(exc, "__notes__", []):
|
|
42
43
|
content = f"{content}\n\nNote: {' '.join(notes)}"
|
|
43
44
|
|
|
44
|
-
OutputManager.get().print_error(content)
|
|
45
|
+
OutputManager.get().print_error(content, hint=get_hint(exc))
|
|
45
46
|
sys.exit(1)
|
|
46
47
|
|
|
47
48
|
|
|
@@ -40,7 +40,7 @@ def get_current_cluster_context() -> ClusterContext:
|
|
|
40
40
|
return current_cluster_context
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
class _Cluster(_Object,
|
|
43
|
+
class _Cluster(_Object, type_prefixes=("cu",)):
|
|
44
44
|
"""A group of containers scheduled together for a clustered Function or Server.
|
|
45
45
|
|
|
46
46
|
Use `Cluster.from_context()` inside a cluster, or `Cluster.from_id()` to
|
|
@@ -126,7 +126,8 @@ _OBSERVABILITY_ONLY_APIS = (
|
|
|
126
126
|
".stats()",
|
|
127
127
|
".get_current_stats()",
|
|
128
128
|
".get_web_url()",
|
|
129
|
-
".autoscaler
|
|
129
|
+
".autoscaler",
|
|
130
|
+
".update_autoscaler()",
|
|
130
131
|
)
|
|
131
132
|
TERMINAL_STATUSES = (
|
|
132
133
|
api_pb2.GenericResult.GENERIC_STATUS_SUCCESS,
|
|
@@ -619,7 +620,7 @@ OriginalReturnType = typing.TypeVar(
|
|
|
619
620
|
T = typing.TypeVar("T", covariant=True)
|
|
620
621
|
|
|
621
622
|
|
|
622
|
-
class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object,
|
|
623
|
+
class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type_prefixes=("fu",)):
|
|
623
624
|
"""Functions are the basic units of serverless execution on Modal.
|
|
624
625
|
|
|
625
626
|
Generally, you will not construct a `Function` directly. Instead, use the
|
|
@@ -1409,7 +1410,6 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1409
1410
|
|
|
1410
1411
|
"""
|
|
1411
1412
|
|
|
1412
|
-
self._check_not_observability_only()
|
|
1413
1413
|
deprecation_warning(
|
|
1414
1414
|
(2026, 10, 16),
|
|
1415
1415
|
"`Function.update_autoscaler()` is deprecated and will be removed in a future version "
|
|
@@ -1527,7 +1527,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
1527
1527
|
|
|
1528
1528
|
If the ID belongs to a Cls, the Function only supports the following APIs:
|
|
1529
1529
|
`.logs`, `.metrics`, `.info()`, `.stats()`, `.get_current_stats()`,
|
|
1530
|
-
`.get_web_url()` and `.
|
|
1530
|
+
`.get_web_url()`, `.autoscaler` and `.update_autoscaler()`. Use `modal.Cls.from_name(...)`
|
|
1531
1531
|
to invoke all other methods.
|
|
1532
1532
|
|
|
1533
1533
|
Args:
|
|
@@ -2371,7 +2371,7 @@ class _Function(typing.Generic[P, ReturnType, OriginalReturnType], _Object, type
|
|
|
2371
2371
|
experimental_spawn_map = MethodWithAio(_experimental_spawn_map_sync, _experimental_spawn_map_async, synchronizer)
|
|
2372
2372
|
|
|
2373
2373
|
|
|
2374
|
-
class _FunctionCall(typing.Generic[ReturnType], _Object,
|
|
2374
|
+
class _FunctionCall(typing.Generic[ReturnType], _Object, type_prefixes=("fc",)):
|
|
2375
2375
|
"""A reference to an executed function call.
|
|
2376
2376
|
|
|
2377
2377
|
Constructed using `.spawn(...)` on a Modal function with the same
|
|
@@ -2704,7 +2704,6 @@ class _FunctionAutoscalerManager:
|
|
|
2704
2704
|
if not self._function._is_hydrated:
|
|
2705
2705
|
await self._function.hydrate()
|
|
2706
2706
|
|
|
2707
|
-
self._function._check_not_observability_only()
|
|
2708
2707
|
settings: api_pb2.AutoscalerSettings = api_pb2.AutoscalerSettings()
|
|
2709
2708
|
|
|
2710
2709
|
if min_containers != UNSET_PARAMETER:
|
|
@@ -587,7 +587,7 @@ class _FailedBuildAttempt:
|
|
|
587
587
|
client: _Client
|
|
588
588
|
|
|
589
589
|
|
|
590
|
-
class _Image(_Object,
|
|
590
|
+
class _Image(_Object, type_prefixes=("im",)):
|
|
591
591
|
"""Base class for container images to run functions in.
|
|
592
592
|
|
|
593
593
|
Do not construct this class directly; instead use one of its static factory methods,
|
|
@@ -2929,8 +2929,8 @@ class _Image(_Object, type_prefix="im"):
|
|
|
2929
2929
|
volumes: Volume and bucket mounts attached for the build.
|
|
2930
2930
|
network_file_systems: Network file systems attached for the build.
|
|
2931
2931
|
gpu: GPU type or list of types for the builder container.
|
|
2932
|
-
cpu: CPU cores to request
|
|
2933
|
-
memory: Memory to request in MiB
|
|
2932
|
+
cpu: CPU cores to request.
|
|
2933
|
+
memory: Memory to request in MiB.
|
|
2934
2934
|
timeout: Maximum build-step runtime in seconds.
|
|
2935
2935
|
cloud: Cloud provider for the builder function.
|
|
2936
2936
|
region: Region or regions for the builder function.
|
|
@@ -82,7 +82,8 @@ def live_method_contextmanager(
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
class _Object:
|
|
85
|
-
|
|
85
|
+
# Prefixes of the object IDs that hydrate this type, e.g. `("sb",)` for `sb-...` IDs.
|
|
86
|
+
_type_prefixes: ClassVar[tuple[str, ...]] = ()
|
|
86
87
|
_prefix_to_type: ClassVar[dict[str, type["_Object"]]] = {}
|
|
87
88
|
|
|
88
89
|
# For constructors
|
|
@@ -114,11 +115,16 @@ class _Object:
|
|
|
114
115
|
self.__is_hydrated = value
|
|
115
116
|
|
|
116
117
|
@classmethod
|
|
117
|
-
def __init_subclass__(cls,
|
|
118
|
+
def __init_subclass__(cls, type_prefixes: Sequence[str] = ()):
|
|
118
119
|
super().__init_subclass__()
|
|
119
|
-
if
|
|
120
|
-
cls.
|
|
121
|
-
|
|
120
|
+
if type_prefixes:
|
|
121
|
+
cls._type_prefixes = tuple(type_prefixes)
|
|
122
|
+
for prefix in cls._type_prefixes:
|
|
123
|
+
cls._prefix_to_type[prefix] = cls
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def _has_type_prefix(cls, object_id: str) -> bool:
|
|
127
|
+
return any(object_id.startswith(prefix + "-") for prefix in cls._type_prefixes)
|
|
122
128
|
|
|
123
129
|
def __init__(self, *args, **kwargs):
|
|
124
130
|
"""mdmd:hidden"""
|
|
@@ -174,11 +180,11 @@ class _Object:
|
|
|
174
180
|
self._client = other._client
|
|
175
181
|
|
|
176
182
|
def _hydrate(self, object_id: str, client: _Client, metadata: Message | None):
|
|
177
|
-
assert isinstance(object_id, str) and self.
|
|
178
|
-
if not
|
|
183
|
+
assert isinstance(object_id, str) and self._type_prefixes
|
|
184
|
+
if not self._has_type_prefix(object_id):
|
|
179
185
|
raise ExecutionError(
|
|
180
186
|
f"Can not hydrate {type(self)}: "
|
|
181
|
-
f" it has type
|
|
187
|
+
f" it has type prefixes {self._type_prefixes}"
|
|
182
188
|
f" but the object_id starts with {object_id[:3]}. "
|
|
183
189
|
"This usually means the object name was previously used for a different type. "
|
|
184
190
|
"Rename the object/app or stop the previous deployment and redeploy."
|
|
@@ -270,11 +276,11 @@ class _Object:
|
|
|
270
276
|
rep: str | None = None,
|
|
271
277
|
) -> Self:
|
|
272
278
|
obj_cls: type[Self]
|
|
273
|
-
if cls.
|
|
279
|
+
if cls._type_prefixes:
|
|
274
280
|
# This is called directly on a subclass, e.g. Secret.from_id
|
|
275
281
|
# validate the id matching the expected id type of the Object subclass
|
|
276
|
-
if not
|
|
277
|
-
raise InvalidError(f"Object {object_id} does not start with {cls.
|
|
282
|
+
if not cls._has_type_prefix(object_id):
|
|
283
|
+
raise InvalidError(f"Object {object_id} does not start with any of {cls._type_prefixes}")
|
|
278
284
|
|
|
279
285
|
obj_cls = cls
|
|
280
286
|
else:
|
|
@@ -207,7 +207,7 @@ class OutputManager(ABC):
|
|
|
207
207
|
...
|
|
208
208
|
|
|
209
209
|
@abstractmethod
|
|
210
|
-
def print_error(self, error_text: str) -> None:
|
|
210
|
+
def print_error(self, error_text: str, hint: str = "") -> None:
|
|
211
211
|
"""Print an error message to stderr, ignoring quiet/disabled mode.
|
|
212
212
|
|
|
213
213
|
This method always prints the error message regardless of quiet mode
|
|
@@ -216,6 +216,7 @@ class OutputManager(ABC):
|
|
|
216
216
|
|
|
217
217
|
Args:
|
|
218
218
|
error_text: The error message text to display.
|
|
219
|
+
hint: An optional suggestion (e.g. "Did you mean ...?") shown after the message.
|
|
219
220
|
"""
|
|
220
221
|
...
|
|
221
222
|
|
|
@@ -490,9 +491,9 @@ class DisabledOutputManager(OutputManager):
|
|
|
490
491
|
) -> None:
|
|
491
492
|
pass
|
|
492
493
|
|
|
493
|
-
def print_error(self, error_text: str) -> None:
|
|
494
|
+
def print_error(self, error_text: str, hint: str = "") -> None:
|
|
494
495
|
# Print error to stderr without any formatting (Rich is not available)
|
|
495
|
-
sys.stderr.write(error_text
|
|
496
|
+
sys.stderr.write(f"{error_text}\n{hint}\n" if hint else f"{error_text}\n")
|
|
496
497
|
|
|
497
498
|
def show_warning(
|
|
498
499
|
self,
|
|
@@ -227,6 +227,19 @@ _ANSI_RESET = "\033[0m"
|
|
|
227
227
|
QUEUEING_STRAGGLER_GRACE_SECS = 30.0
|
|
228
228
|
|
|
229
229
|
|
|
230
|
+
def format_error_message(error_text: str, hint: str = "") -> Text:
|
|
231
|
+
"""Build the styled text for a CLI error message.
|
|
232
|
+
|
|
233
|
+
The message and hint are taken literally (no markup is interpreted). The message gets an
|
|
234
|
+
"Error:" prefix, and the hint, if any, follows on the next line in a dim style.
|
|
235
|
+
"""
|
|
236
|
+
message = Text.assemble(("Error:", "bold red"), " ", error_text)
|
|
237
|
+
if hint:
|
|
238
|
+
message.append("\n")
|
|
239
|
+
message.append(hint, style="dim")
|
|
240
|
+
return message
|
|
241
|
+
|
|
242
|
+
|
|
230
243
|
class RichOutputManager(OutputManager):
|
|
231
244
|
"""Rich-based implementation of OutputManager.
|
|
232
245
|
|
|
@@ -347,13 +360,13 @@ class RichOutputManager(OutputManager):
|
|
|
347
360
|
else:
|
|
348
361
|
self._console.print(renderable, highlight=highlight, style=style, sep=sep, end=end)
|
|
349
362
|
|
|
350
|
-
def print_error(self, error_text: str) -> None:
|
|
351
|
-
"""Print an error message
|
|
363
|
+
def print_error(self, error_text: str, hint: str = "") -> None:
|
|
364
|
+
"""Print an error message, and an optional suggestion hint, to stderr, ignoring quiet mode.
|
|
352
365
|
|
|
353
|
-
|
|
366
|
+
The message is printed as-is after a styled "Error:" prefix, without hard line wrapping,
|
|
367
|
+
so that a single-line message stays on one line regardless of terminal width.
|
|
354
368
|
"""
|
|
355
|
-
|
|
356
|
-
self._stderr_console.print(panel, highlight=False)
|
|
369
|
+
self._stderr_console.print(format_error_message(error_text, hint), highlight=False, soft_wrap=True)
|
|
357
370
|
|
|
358
371
|
def print_json(self, data: str) -> None:
|
|
359
372
|
"""Print JSON data with formatting."""
|
|
@@ -230,7 +230,7 @@ class _TaskLifecycleManager:
|
|
|
230
230
|
api_pb2.ContainerCheckpointRequest(checkpoint_id=self.checkpoint_id)
|
|
231
231
|
)
|
|
232
232
|
|
|
233
|
-
await self._client.
|
|
233
|
+
await self._client._prep_for_snapshot()
|
|
234
234
|
|
|
235
235
|
logger.debug("Memory snapshot request sent. Connection closed.")
|
|
236
236
|
await self.memory_restore()
|
|
@@ -864,19 +864,37 @@ class AsyncOrSyncIterable:
|
|
|
864
864
|
await self._async_iterable.aclose()
|
|
865
865
|
|
|
866
866
|
|
|
867
|
-
_shutdown_tasks =
|
|
867
|
+
_shutdown_tasks: set[asyncio.Task] = set()
|
|
868
868
|
|
|
869
869
|
|
|
870
|
-
def on_shutdown(
|
|
870
|
+
def on_shutdown(cleanup: Callable[[], Awaitable[Any]]) -> Callable[[], None]:
|
|
871
871
|
# hook into event loop shutdown when all active tasks get cancelled
|
|
872
|
+
active = True
|
|
873
|
+
|
|
872
874
|
async def wrapper():
|
|
875
|
+
nonlocal active
|
|
873
876
|
try:
|
|
874
877
|
await asyncio.sleep(1e10) # never awake except for exceptions
|
|
875
878
|
finally:
|
|
876
|
-
|
|
877
|
-
|
|
879
|
+
if active:
|
|
880
|
+
active = False
|
|
881
|
+
await cleanup()
|
|
882
|
+
|
|
883
|
+
task = asyncio.create_task(wrapper())
|
|
884
|
+
_shutdown_tasks.add(task)
|
|
885
|
+
task.add_done_callback(_shutdown_tasks.discard)
|
|
886
|
+
|
|
887
|
+
def unregister():
|
|
888
|
+
nonlocal active
|
|
889
|
+
if not active:
|
|
890
|
+
return
|
|
891
|
+
active = False
|
|
892
|
+
_shutdown_tasks.discard(task)
|
|
893
|
+
loop = task.get_loop()
|
|
894
|
+
if not loop.is_closed() and not task.done() and task is not asyncio.current_task(loop=loop):
|
|
895
|
+
task.cancel()
|
|
878
896
|
|
|
879
|
-
|
|
897
|
+
return unregister
|
|
880
898
|
|
|
881
899
|
|
|
882
900
|
def asyncify(f: Callable[P, T]) -> Callable[P, typing.Coroutine[None, None, T]]:
|
|
@@ -54,6 +54,17 @@ class _AuthTokenManager:
|
|
|
54
54
|
self._backoff = self.FAILURE_BACKOFF_BASE
|
|
55
55
|
self._refresh_task: asyncio.Task | None = None
|
|
56
56
|
|
|
57
|
+
async def reset(self) -> None:
|
|
58
|
+
if self._refresh_task is not None:
|
|
59
|
+
self._refresh_task.cancel()
|
|
60
|
+
await asyncio.gather(self._refresh_task, return_exceptions=True)
|
|
61
|
+
self._refresh_task = None
|
|
62
|
+
self._token = ""
|
|
63
|
+
self._expiry = 0.0
|
|
64
|
+
self._refresh_at = 0.0
|
|
65
|
+
self._retry_after = 0.0
|
|
66
|
+
self._backoff = self.FAILURE_BACKOFF_BASE
|
|
67
|
+
|
|
57
68
|
async def get_token(self) -> str:
|
|
58
69
|
"""
|
|
59
70
|
When called, the AuthTokenManager can be in one of three states:
|
|
@@ -80,6 +91,12 @@ class _AuthTokenManager:
|
|
|
80
91
|
|
|
81
92
|
return self._token
|
|
82
93
|
|
|
94
|
+
async def close(self) -> None:
|
|
95
|
+
task, self._refresh_task = self._refresh_task, None
|
|
96
|
+
if task is not None:
|
|
97
|
+
task.cancel()
|
|
98
|
+
await asyncio.gather(task, return_exceptions=True)
|
|
99
|
+
|
|
83
100
|
async def _try_refresh_token(self):
|
|
84
101
|
try:
|
|
85
102
|
await self._refresh_token()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Copyright Modal Labs 2022
|
|
2
2
|
import contextlib
|
|
3
|
-
from typing import TYPE_CHECKING
|
|
3
|
+
from typing import TYPE_CHECKING, ClassVar
|
|
4
4
|
|
|
5
5
|
# Note: importing aiohttp seems to take about 100ms, and it's not really necessarily,
|
|
6
6
|
# unless we need to work with blobs. So that's why we import it lazily instead.
|
|
@@ -54,20 +54,26 @@ def _http_client_with_tls(timeout: float | None) -> "ClientSession":
|
|
|
54
54
|
class ClientSessionRegistry:
|
|
55
55
|
_client_session: "ClientSession"
|
|
56
56
|
_client_session_active: bool = False
|
|
57
|
+
_shutdown_unregister: "ClassVar[staticmethod[[], None] | None]" = None
|
|
57
58
|
|
|
58
59
|
@staticmethod
|
|
59
60
|
def get_session():
|
|
60
61
|
if not ClientSessionRegistry._client_session_active:
|
|
61
62
|
ClientSessionRegistry._client_session = _http_client_with_tls(timeout=None)
|
|
62
63
|
ClientSessionRegistry._client_session_active = True
|
|
63
|
-
on_shutdown(ClientSessionRegistry.close_session
|
|
64
|
+
ClientSessionRegistry._shutdown_unregister = staticmethod(on_shutdown(ClientSessionRegistry.close_session))
|
|
64
65
|
return ClientSessionRegistry._client_session
|
|
65
66
|
|
|
66
67
|
@staticmethod
|
|
67
68
|
async def close_session():
|
|
69
|
+
if ClientSessionRegistry._shutdown_unregister is not None:
|
|
70
|
+
ClientSessionRegistry._shutdown_unregister()
|
|
71
|
+
ClientSessionRegistry._shutdown_unregister = None
|
|
68
72
|
if ClientSessionRegistry._client_session_active:
|
|
69
|
-
|
|
73
|
+
session = ClientSessionRegistry._client_session
|
|
74
|
+
del ClientSessionRegistry._client_session
|
|
70
75
|
ClientSessionRegistry._client_session_active = False
|
|
76
|
+
await session.close()
|
|
71
77
|
|
|
72
78
|
|
|
73
79
|
@contextlib.asynccontextmanager
|
|
@@ -71,7 +71,7 @@ class _WorkspaceMembersManager:
|
|
|
71
71
|
]
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
class _Workspace(_Object,
|
|
74
|
+
class _Workspace(_Object, type_prefixes=("ac",)):
|
|
75
75
|
_name: Optional[str] = None
|
|
76
76
|
|
|
77
77
|
def __init__(self):
|
|
@@ -773,6 +773,62 @@ class _WorkspaceMemberTokenManager:
|
|
|
773
773
|
|
|
774
774
|
return [MemberTokenInfo._from_proto(token) for token in resp.tokens]
|
|
775
775
|
|
|
776
|
+
async def disable(self, *token_ids: str) -> None:
|
|
777
|
+
"""Disable member tokens in the specified Workspace.
|
|
778
|
+
|
|
779
|
+
If you are a Workspace Manager or Owner, you can use this method to disable any token in the
|
|
780
|
+
Workspace. Otherwise, you can only disable tokens that you have created. Disabled tokens cannot
|
|
781
|
+
be used to authenticate with Modal, but can be re-enabled at any point.
|
|
782
|
+
|
|
783
|
+
Args:
|
|
784
|
+
*token_ids: The ID(s) of any tokens you want to disable.
|
|
785
|
+
|
|
786
|
+
Examples:
|
|
787
|
+
|
|
788
|
+
```python notest
|
|
789
|
+
ws = modal.Workspace.from_context()
|
|
790
|
+
ws.member_tokens.disable("ak-0123456789abcdefghijkl", "ak-mnopqrstuvwxyz01234567")
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
See Also:
|
|
794
|
+
- [`Workspace.member_tokens.enable()`](https://modal.com/docs/sdk/py/latest/Workspace#member_tokensenable):
|
|
795
|
+
A function that re-enables a disabled token, so that it may be used again.
|
|
796
|
+
- [`modal workspace member-tokens disable`](https://modal.com/docs/cli/latest/workspace#modal-workspace-member-tokens-disable)
|
|
797
|
+
Command-line equivalent to this function.
|
|
798
|
+
|
|
799
|
+
"""
|
|
800
|
+
if not self._workspace._is_hydrated:
|
|
801
|
+
await self._workspace.hydrate()
|
|
802
|
+
|
|
803
|
+
await self._workspace.client._stub.TokenDisable(api_pb2.TokenDisableRequest(token_ids=list(set(token_ids))))
|
|
804
|
+
|
|
805
|
+
async def enable(self, *token_ids: str) -> None:
|
|
806
|
+
"""Re-enable member tokens that have been disabled in the specified Workspace.
|
|
807
|
+
|
|
808
|
+
If you are a Workspace Manager or Owner, you can use this method to enable any token in the
|
|
809
|
+
Workspace. Otherwise, you can only enable tokens that you have created.
|
|
810
|
+
|
|
811
|
+
Args:
|
|
812
|
+
*token_ids: The ID(s) of any tokens you want to enable.
|
|
813
|
+
|
|
814
|
+
Examples:
|
|
815
|
+
|
|
816
|
+
```python notest
|
|
817
|
+
ws = modal.Workspace.from_context()
|
|
818
|
+
ws.member_tokens.enable("ak-0123456789abcdefghijkl", "ak-mnopqrstuvwxyz01234567")
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
See Also:
|
|
822
|
+
- [`Workspace.member_tokens.disable()`](https://modal.com/docs/sdk/py/latest/Workspace#member_tokensdisable).
|
|
823
|
+
A function that disables a token, so that it may not be used to authenticate with Modal.
|
|
824
|
+
- [`modal workspace member-tokens enable`](https://modal.com/docs/cli/latest/workspace#modal-workspace-member-tokens-enable)
|
|
825
|
+
Command-line equivalent to this function.
|
|
826
|
+
"""
|
|
827
|
+
if not self._workspace._is_hydrated:
|
|
828
|
+
await self._workspace.hydrate()
|
|
829
|
+
|
|
830
|
+
await self._workspace.client._stub.TokenEnable(api_pb2.TokenEnableRequest(token_ids=list(set(token_ids))))
|
|
831
|
+
|
|
776
832
|
async def delete(self, token_id: str, *, allow_missing: bool = False) -> None:
|
|
777
833
|
"""Delete a Member Token in the specified Workspace.
|
|
778
834
|
|
|
@@ -3,7 +3,7 @@ import inspect
|
|
|
3
3
|
import typing
|
|
4
4
|
from collections.abc import AsyncGenerator, Callable, Collection, Coroutine, Mapping, Sequence
|
|
5
5
|
from dataclasses import dataclass
|
|
6
|
-
from datetime import datetime, timezone
|
|
6
|
+
from datetime import datetime, timedelta, timezone
|
|
7
7
|
from pathlib import PurePosixPath
|
|
8
8
|
from textwrap import dedent
|
|
9
9
|
from typing import (
|
|
@@ -43,7 +43,7 @@ from ._utils.function_utils import (
|
|
|
43
43
|
validate_target_concurrency,
|
|
44
44
|
)
|
|
45
45
|
from ._utils.mount_utils import validate_volumes
|
|
46
|
-
from ._utils.name_utils import check_object_name, check_tag_dict
|
|
46
|
+
from ._utils.name_utils import check_object_name, check_tag_dict, is_app_id
|
|
47
47
|
from .client import _Client
|
|
48
48
|
from .cloud_bucket_mount import _CloudBucketMount
|
|
49
49
|
from .cls import _Cls, parameter
|
|
@@ -57,7 +57,7 @@ from .retries import Retries
|
|
|
57
57
|
from .running_app import RunningApp
|
|
58
58
|
from .schedule import Schedule
|
|
59
59
|
from .secret import _Secret
|
|
60
|
-
from .types import AppInfo, SandboxGroupStats
|
|
60
|
+
from .types import AppInfo, AppStats, SandboxGroupStats
|
|
61
61
|
from .volume import _Volume
|
|
62
62
|
|
|
63
63
|
_default_image: _Image = _Image.debian_slim()
|
|
@@ -168,9 +168,9 @@ class _AppSandboxesManager:
|
|
|
168
168
|
Yields:
|
|
169
169
|
`SandboxGroupStats` objects, one per combination of tag values, with the following fields:
|
|
170
170
|
- `tags`: the value of each name in `group_by_tags` for the group's Sandboxes, `None` where not present.
|
|
171
|
-
- `cost`: total cost in USD
|
|
172
|
-
- `cost_by_resource`: cost in USD by billed resource: `CPU`, `Memory`, and GPU
|
|
173
|
-
`H100`. The resource names are subject to change as Modal's billing model evolves.
|
|
171
|
+
- `cost`: total cost in USD as a `decimal.Decimal`, the sum of `cost_by_resource`.
|
|
172
|
+
- `cost_by_resource`: cost in USD as `decimal.Decimal`s, by billed resource: `CPU`, `Memory`, and GPU
|
|
173
|
+
types such as `H100`. The resource names are subject to change as Modal's billing model evolves.
|
|
174
174
|
|
|
175
175
|
Raises:
|
|
176
176
|
InvalidError: If the time range is invalid or there are more than 10,000 groups.
|
|
@@ -421,28 +421,47 @@ class _App:
|
|
|
421
421
|
environment_name: str | None = None,
|
|
422
422
|
create_if_missing: bool = False,
|
|
423
423
|
) -> "_App":
|
|
424
|
-
"""Look up an App
|
|
424
|
+
"""Look up an App by name or App ID, creating a new App if necessary.
|
|
425
425
|
|
|
426
426
|
Note that Apps created through this method will be in a deployed state,
|
|
427
427
|
but they will not have any associated Functions or Classes. This method
|
|
428
428
|
is mainly useful for creating an App to associate with a Sandbox.
|
|
429
429
|
|
|
430
|
+
Passing an App ID (`ap-...`) instead of a name looks up that specific App,
|
|
431
|
+
which also works for ephemeral Apps started with `app.run()` and for stopped
|
|
432
|
+
Apps. A lookup by ID ignores `environment_name` and cannot be combined with
|
|
433
|
+
`create_if_missing`.
|
|
434
|
+
|
|
430
435
|
Args:
|
|
431
|
-
name: App name to resolve or create.
|
|
436
|
+
name: App name to resolve or create, or the ID of an existing App.
|
|
432
437
|
client: Modal client to use; defaults to `Client.from_env()` when omitted.
|
|
433
438
|
environment_name: Optional environment name; defaults to the configured environment.
|
|
439
|
+
Ignored when `name` is an App ID.
|
|
434
440
|
create_if_missing: If True, create the app when it does not already exist.
|
|
441
|
+
Not supported when looking up an App by ID.
|
|
435
442
|
|
|
436
443
|
Returns:
|
|
437
|
-
An `App` handle tied to the
|
|
444
|
+
An `App` handle tied to the App record.
|
|
438
445
|
|
|
439
446
|
Examples:
|
|
440
447
|
```python
|
|
441
448
|
app = modal.App.lookup("my-app", create_if_missing=True)
|
|
442
449
|
modal.Sandbox.create("echo", "hi", app=app)
|
|
443
450
|
```
|
|
451
|
+
|
|
452
|
+
Look up an ephemeral App by its ID and read its most recent logs:
|
|
453
|
+
|
|
454
|
+
```python notest
|
|
455
|
+
app = modal.App.lookup("ap-Xk7fT2qLm9RzVb4NwYc8Hd")
|
|
456
|
+
for entry in app.logs.tail(20):
|
|
457
|
+
print(entry.message, end="")
|
|
458
|
+
```
|
|
444
459
|
"""
|
|
445
|
-
|
|
460
|
+
if is_app_id(name):
|
|
461
|
+
if create_if_missing:
|
|
462
|
+
raise InvalidError("`create_if_missing=True` is not supported when looking up an App by ID.")
|
|
463
|
+
else:
|
|
464
|
+
check_object_name(name, "App")
|
|
446
465
|
|
|
447
466
|
if client is None:
|
|
448
467
|
client = await _Client.from_env()
|
|
@@ -1764,6 +1783,45 @@ class _App:
|
|
|
1764
1783
|
"""Namespace for the Sandboxes belonging to this App."""
|
|
1765
1784
|
return _AppSandboxesManager(self)
|
|
1766
1785
|
|
|
1786
|
+
async def stats(self, *, since: datetime | None = None, until: datetime | None = None) -> AppStats:
|
|
1787
|
+
"""Return aggregate Function, Server, and Sandbox statistics for this App.
|
|
1788
|
+
|
|
1789
|
+
The default window is the most recent hour. Windows can span at most seven days,
|
|
1790
|
+
with a start in the past 30 days.
|
|
1791
|
+
|
|
1792
|
+
App stats show total call counts, request counts, and the count of active and errored containers in
|
|
1793
|
+
the time window. The count of sandboxes that finished in the interval as well as the count
|
|
1794
|
+
that were still running as of the end of the window is also returned.
|
|
1795
|
+
|
|
1796
|
+
The available stats and their definitions are subject to change and are provided
|
|
1797
|
+
on a best-effort basis. They may be delayed or incomplete.
|
|
1798
|
+
|
|
1799
|
+
Args:
|
|
1800
|
+
since: The beginning of the time range, inclusive. If omitted, this defaults to an hour before `until`.
|
|
1801
|
+
Values without a timezone are interpeted as local time.
|
|
1802
|
+
until: The end of the time range, exclusive. If omitted, this defaults to current time.
|
|
1803
|
+
Values without a timezone are interpeted as local time.
|
|
1804
|
+
|
|
1805
|
+
Examples:
|
|
1806
|
+
```python notest
|
|
1807
|
+
stats = modal.App.lookup("my-app").stats()
|
|
1808
|
+
print(stats.functions.total.calls.failed)
|
|
1809
|
+
print(stats.functions["embed"].counts.containers.errors)
|
|
1810
|
+
```
|
|
1811
|
+
"""
|
|
1812
|
+
if not self._app_id:
|
|
1813
|
+
raise InvalidError("`app.stats` requires a running or stopped app.")
|
|
1814
|
+
until = (until or datetime.now(timezone.utc)).astimezone(timezone.utc)
|
|
1815
|
+
since = (since or until - timedelta(hours=1)).astimezone(timezone.utc)
|
|
1816
|
+
if since >= until:
|
|
1817
|
+
raise InvalidError("`since` must be before `until`.")
|
|
1818
|
+
request = api_pb2.AppGetTimeRangeStatsRequest(app_id=self._app_id)
|
|
1819
|
+
request.since.FromDatetime(since)
|
|
1820
|
+
request.until.FromDatetime(until)
|
|
1821
|
+
client = self._client or await _Client.from_env()
|
|
1822
|
+
response = await client._stub.AppGetTimeRangeStats(request)
|
|
1823
|
+
return AppStats._from_proto(response)
|
|
1824
|
+
|
|
1767
1825
|
async def info(self, refresh: bool = False) -> AppInfo:
|
|
1768
1826
|
"""Return information for a modal `App`.
|
|
1769
1827
|
|