cortexgrid 0.2.90__tar.gz → 0.2.91__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cortexgrid
3
- Version: 0.2.90
3
+ Version: 0.2.91
4
4
  Summary: Connect your ML code to the RoboLab compute cluster — Ray, MLflow, and S3
5
5
  Project-URL: Homepage, https://github.com/robodatalab/cortexgrid
6
6
  Project-URL: Repository, https://github.com/robodatalab/cortexgrid
@@ -21,6 +21,7 @@ from __future__ import annotations
21
21
  import inspect
22
22
  import json
23
23
  import logging
24
+ import re
24
25
  import shutil
25
26
  import tempfile
26
27
  import time
@@ -404,3 +405,43 @@ def model_serving_status(
404
405
  message=str(app.get("message", "")) or raw,
405
406
  url=f"{get_ray_serve_uri()}{_route_prefix(family, suffix, run_name)}",
406
407
  )
408
+
409
+
410
+ @dataclass
411
+ class ServingMessage:
412
+ """One message the Ray Serve controller reports for a model's app. `source`
413
+ is "application" for the app-level message (e.g. the app failed to build)
414
+ or a deployment name for that deployment's message (e.g. its replicas
415
+ failed to start); `status` is the raw Ray Serve status of that source."""
416
+
417
+ source: str
418
+ status: str
419
+ message: str
420
+
421
+
422
+ # Ray colors parts of its messages (e.g. the serialization checker's "!!! FAIL")
423
+ # with ANSI escapes, which are noise outside a terminal.
424
+ _ANSI_ESCAPE = re.compile(r"\x1b\[[0-9;]*m")
425
+
426
+
427
+ def model_serving_messages(
428
+ family: str, suffix: str, run_name: str
429
+ ) -> list[ServingMessage]:
430
+ """Return the non-empty controller messages for a model's Serve app: the
431
+ app-level message first, then each deployment's. Empty when no app exists.
432
+ This is where Ray explains a DEPLOY_FAILED or UNHEALTHY app."""
433
+ app = get_serve_details().get("applications", {}).get(
434
+ _app_name(family, suffix, run_name)
435
+ )
436
+ if app is None:
437
+ return []
438
+ sources = [("application", app)] + list(app.get("deployments", {}).items())
439
+ return [
440
+ ServingMessage(
441
+ source=source,
442
+ status=str(details.get("status", "")),
443
+ message=_ANSI_ESCAPE.sub("", str(details["message"])),
444
+ )
445
+ for source, details in sources
446
+ if details.get("message")
447
+ ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cortexgrid"
3
- version = "0.2.90"
3
+ version = "0.2.91"
4
4
  description = "Connect your ML code to the RoboLab compute cluster — Ray, MLflow, and S3"
5
5
  readme = "docs/cortexgrid/README.md"
6
6
  license = "Apache-2.0"
File without changes
File without changes