modal 0.74.48__py3-none-any.whl → 0.74.49__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.
- modal/_utils/logger.py +16 -7
- modal/client.pyi +2 -2
- modal/config.py +6 -0
- {modal-0.74.48.dist-info → modal-0.74.49.dist-info}/METADATA +1 -1
- {modal-0.74.48.dist-info → modal-0.74.49.dist-info}/RECORD +10 -10
- modal_version/_version_generated.py +1 -1
- {modal-0.74.48.dist-info → modal-0.74.49.dist-info}/WHEEL +0 -0
- {modal-0.74.48.dist-info → modal-0.74.49.dist-info}/entry_points.txt +0 -0
- {modal-0.74.48.dist-info → modal-0.74.49.dist-info}/licenses/LICENSE +0 -0
- {modal-0.74.48.dist-info → modal-0.74.49.dist-info}/top_level.txt +0 -0
modal/_utils/logger.py
CHANGED
@@ -4,33 +4,42 @@ import os
|
|
4
4
|
|
5
5
|
|
6
6
|
def configure_logger(logger: logging.Logger, log_level: str, log_format: str):
|
7
|
+
from modal.config import config
|
8
|
+
|
7
9
|
ch = logging.StreamHandler()
|
8
10
|
log_level_numeric = logging.getLevelName(log_level.upper())
|
9
11
|
logger.setLevel(log_level_numeric)
|
10
12
|
ch.setLevel(log_level_numeric)
|
11
|
-
|
13
|
+
datefmt = "%Y-%m-%dT%H:%M:%S%z"
|
12
14
|
if log_format.upper() == "JSON":
|
13
15
|
# This is primarily for modal internal use.
|
14
16
|
# pythonjsonlogger is already installed in the environment.
|
15
17
|
from pythonjsonlogger import jsonlogger
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
+
if not (log_format_pattern := config.get("log_pattern")):
|
20
|
+
log_format_pattern = (
|
19
21
|
"%(asctime)s %(levelname)s [%(name)s] [%(filename)s:%(lineno)d] "
|
20
22
|
"[dd.service=%(dd.service)s dd.env=%(dd.env)s dd.version=%(dd.version)s dd.trace_id=%(dd.trace_id)s "
|
21
23
|
"dd.span_id=%(dd.span_id)s] "
|
22
24
|
"- %(message)s"
|
23
|
-
)
|
24
|
-
datefmt="%Y-%m-%dT%H:%M:%S%z",
|
25
|
-
)
|
25
|
+
)
|
26
26
|
|
27
|
+
json_formatter = jsonlogger.JsonFormatter(
|
28
|
+
fmt=log_format_pattern,
|
29
|
+
datefmt=datefmt,
|
30
|
+
)
|
27
31
|
ch.setFormatter(json_formatter)
|
28
32
|
else:
|
29
|
-
|
33
|
+
if not (log_format_pattern := config.get("log_pattern")):
|
34
|
+
# TODO: use `%(name)s` instead of `modal-client` as soon as we unify the loggers we use
|
35
|
+
log_format_pattern = "[modal-client] %(asctime)s %(message)s"
|
36
|
+
|
37
|
+
ch.setFormatter(logging.Formatter(log_format_pattern, datefmt=datefmt))
|
30
38
|
|
31
39
|
logger.addHandler(ch)
|
32
40
|
|
33
41
|
|
42
|
+
# TODO: remove this distinct logger in favor of the one in modal.config?
|
34
43
|
log_level = os.environ.get("MODAL_LOGLEVEL", "WARNING")
|
35
44
|
log_format = os.environ.get("MODAL_LOG_FORMAT", "STRING")
|
36
45
|
|
modal/client.pyi
CHANGED
@@ -27,7 +27,7 @@ class _Client:
|
|
27
27
|
_snapshotted: bool
|
28
28
|
|
29
29
|
def __init__(
|
30
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.74.
|
30
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.74.49"
|
31
31
|
): ...
|
32
32
|
def is_closed(self) -> bool: ...
|
33
33
|
@property
|
@@ -85,7 +85,7 @@ class Client:
|
|
85
85
|
_snapshotted: bool
|
86
86
|
|
87
87
|
def __init__(
|
88
|
-
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.74.
|
88
|
+
self, server_url: str, client_type: int, credentials: typing.Optional[tuple[str, str]], version: str = "0.74.49"
|
89
89
|
): ...
|
90
90
|
def is_closed(self) -> bool: ...
|
91
91
|
@property
|
modal/config.py
CHANGED
@@ -70,6 +70,11 @@ Other possible configuration options are:
|
|
70
70
|
* `traceback` (in the .toml file) / `MODAL_TRACEBACK` (as an env var).
|
71
71
|
Defaults to False. Enables printing full tracebacks on unexpected CLI
|
72
72
|
errors, which can be useful for debugging client issues.
|
73
|
+
* `log_pattern` (in the .toml file) / MODAL_LOG_PATTERN` (as an env var).
|
74
|
+
Defaults to "[modal-client] %(asctime)s %(message)s"
|
75
|
+
The log formatting pattern that will be used by the modal client itself.
|
76
|
+
See https://docs.python.org/3/library/logging.html#logrecord-attributes for available
|
77
|
+
log attributes.
|
73
78
|
|
74
79
|
Meta-configuration
|
75
80
|
------------------
|
@@ -216,6 +221,7 @@ class _Setting(typing.NamedTuple):
|
|
216
221
|
_SETTINGS = {
|
217
222
|
"loglevel": _Setting("WARNING", lambda s: s.upper()),
|
218
223
|
"log_format": _Setting("STRING", lambda s: s.upper()),
|
224
|
+
"log_pattern": _Setting(), # optional override of the formatting pattern
|
219
225
|
"server_url": _Setting("https://api.modal.com"),
|
220
226
|
"token_id": _Setting(),
|
221
227
|
"token_secret": _Setting(),
|
@@ -22,12 +22,12 @@ modal/app.py,sha256=r-9vVU1lrR1CWtJEo60fuaianvxY_oOXZyv1Qx1DEkI,51231
|
|
22
22
|
modal/app.pyi,sha256=0QNtnUpAFbOPcbwCt119ge7OmoBqMFw5SajLgdE5eOw,28600
|
23
23
|
modal/call_graph.py,sha256=1g2DGcMIJvRy-xKicuf63IVE98gJSnQsr8R_NVMptNc,2581
|
24
24
|
modal/client.py,sha256=U-YKSw0n7J1ZLREt9cbEJCtmHe5YoPKFxl0xlkan2yc,15565
|
25
|
-
modal/client.pyi,sha256=
|
25
|
+
modal/client.pyi,sha256=aMgJftZr5pTStBb0n4tz8sgLrlKIaRZdrBMMEh9rFVg,7593
|
26
26
|
modal/cloud_bucket_mount.py,sha256=YOe9nnvSr4ZbeCn587d7_VhE9IioZYRvF9VYQTQux08,5914
|
27
27
|
modal/cloud_bucket_mount.pyi,sha256=30T3K1a89l6wzmEJ_J9iWv9SknoGqaZDx59Xs-ZQcmk,1607
|
28
28
|
modal/cls.py,sha256=aHoMEWMZUN7bOezs3tRPxzS1FP3gTxZBORVjbPmtxyg,35338
|
29
29
|
modal/cls.pyi,sha256=B--Y4xEOo3GRE3QiiFdIE8jnIKEeBcOtwAbXvg2Z8H4,12012
|
30
|
-
modal/config.py,sha256=
|
30
|
+
modal/config.py,sha256=_2KU5jG-vZQ4vDLYQ83r4aQdnjnN00TY12DtSJMGYsA,12617
|
31
31
|
modal/container_process.py,sha256=vvyK3DVPUMsuqvkKdUiQ49cDLF9JawGrxpglLk5vfgI,6208
|
32
32
|
modal/container_process.pyi,sha256=bXs2KHe7nxVuLAm6RRBqXCvDKelANGX9gFY8qIuZYDs,2898
|
33
33
|
modal/dict.py,sha256=7NJVI05hisF9gTuJMYestH9X0LIOaE9PPqbCeYtwSRs,13365
|
@@ -103,7 +103,7 @@ modal/_utils/grpc_utils.py,sha256=VmVHEFxEWXNLrgYwLk0vFwwls8g97Pg6B4RGz_5RA1w,92
|
|
103
103
|
modal/_utils/hash_utils.py,sha256=zg3J6OGxTFGSFri1qQ12giDz90lWk8bzaxCTUCRtiX4,3034
|
104
104
|
modal/_utils/http_utils.py,sha256=yeTFsXYr0rYMEhB7vBP7audG9Uc7OLhzKBANFDZWVt0,2451
|
105
105
|
modal/_utils/jwt_utils.py,sha256=fxH9plyrbAemTbjSsQtzIdDXE9QXxvMC4DiUZ16G0aA,1360
|
106
|
-
modal/_utils/logger.py,sha256=
|
106
|
+
modal/_utils/logger.py,sha256=NgbMKFT9chYYt_TU01DdIior5ByYr2gZtrWIk1SFRLc,1782
|
107
107
|
modal/_utils/mount_utils.py,sha256=gGCgIlWwYiJbUtgFY2GJcWYismYvazbMAeUOgf7NhFQ,3205
|
108
108
|
modal/_utils/name_utils.py,sha256=TW1iyJedvDNPEJ5UVp93u8xuD5J2gQL_CUt1mgov_aI,1939
|
109
109
|
modal/_utils/package_utils.py,sha256=LcL2olGN4xaUzu2Tbv-C-Ft9Qp6bsLxEfETOAVd-mjU,2073
|
@@ -145,7 +145,7 @@ modal/requirements/2024.10.txt,sha256=qD-5cVIVM9wXesJ6JC89Ew-3m2KjEElUz3jaw_MddR
|
|
145
145
|
modal/requirements/PREVIEW.txt,sha256=qD-5cVIVM9wXesJ6JC89Ew-3m2KjEElUz3jaw_MddRo,296
|
146
146
|
modal/requirements/README.md,sha256=9tK76KP0Uph7O0M5oUgsSwEZDj5y-dcUPsnpR0Sc-Ik,854
|
147
147
|
modal/requirements/base-images.json,sha256=57vMSqzMbLBxw5tFWSaMiIkkVEps4JfX5PAtXGnkS4U,740
|
148
|
-
modal-0.74.
|
148
|
+
modal-0.74.49.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
149
149
|
modal_docs/__init__.py,sha256=svYKtV8HDwDCN86zbdWqyq5T8sMdGDj0PVlzc2tIxDM,28
|
150
150
|
modal_docs/gen_cli_docs.py,sha256=c1yfBS_x--gL5bs0N4ihMwqwX8l3IBWSkBAKNNIi6bQ,3801
|
151
151
|
modal_docs/gen_reference_docs.py,sha256=d_CQUGQ0rfw28u75I2mov9AlS773z9rG40-yq5o7g2U,6359
|
@@ -170,9 +170,9 @@ modal_proto/options_pb2_grpc.pyi,sha256=CImmhxHsYnF09iENPoe8S4J-n93jtgUYD2JPAc0y
|
|
170
170
|
modal_proto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
171
171
|
modal_version/__init__.py,sha256=m94xZNWIjH8oUtJk4l9xfovzDJede2o7X-q0MHVECtM,470
|
172
172
|
modal_version/__main__.py,sha256=2FO0yYQQwDTh6udt1h-cBnGd1c4ZyHnHSI4BksxzVac,105
|
173
|
-
modal_version/_version_generated.py,sha256
|
174
|
-
modal-0.74.
|
175
|
-
modal-0.74.
|
176
|
-
modal-0.74.
|
177
|
-
modal-0.74.
|
178
|
-
modal-0.74.
|
173
|
+
modal_version/_version_generated.py,sha256=-h2evheb0h6ZeCRd4OY4P-xlD3f4lAxmMFdV25T_ZpM,149
|
174
|
+
modal-0.74.49.dist-info/METADATA,sha256=WVM_5pHEfZr-wAqhPek3gvwIZMAWoKWpdeUjIw-Bveo,2451
|
175
|
+
modal-0.74.49.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
176
|
+
modal-0.74.49.dist-info/entry_points.txt,sha256=An-wYgeEUnm6xzrAP9_NTSTSciYvvEWsMZILtYrvpAI,46
|
177
|
+
modal-0.74.49.dist-info/top_level.txt,sha256=4BWzoKYREKUZ5iyPzZpjqx4G8uB5TWxXPDwibLcVa7k,43
|
178
|
+
modal-0.74.49.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|