plexus-python 0.11.1__py3-none-any.whl → 0.11.2__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.
- plexus/__init__.py +1 -1
- plexus/client.py +27 -6
- {plexus_python-0.11.1.dist-info → plexus_python-0.11.2.dist-info}/METADATA +1 -1
- {plexus_python-0.11.1.dist-info → plexus_python-0.11.2.dist-info}/RECORD +7 -7
- {plexus_python-0.11.1.dist-info → plexus_python-0.11.2.dist-info}/WHEEL +0 -0
- {plexus_python-0.11.1.dist-info → plexus_python-0.11.2.dist-info}/entry_points.txt +0 -0
- {plexus_python-0.11.1.dist-info → plexus_python-0.11.2.dist-info}/licenses/LICENSE +0 -0
plexus/__init__.py
CHANGED
plexus/client.py
CHANGED
|
@@ -60,10 +60,12 @@ if TYPE_CHECKING: # pragma: no cover - typing only
|
|
|
60
60
|
logger = logging.getLogger(__name__)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
def
|
|
64
|
-
"""
|
|
65
|
-
return
|
|
66
|
-
|
|
63
|
+
def _iso_from_ms(ms: int) -> str:
|
|
64
|
+
"""Epoch milliseconds as ISO-8601 with a Z offset — /api/runs validates the shape."""
|
|
65
|
+
return (
|
|
66
|
+
datetime.fromtimestamp(ms / 1000, timezone.utc)
|
|
67
|
+
.isoformat(timespec="milliseconds")
|
|
68
|
+
.replace("+00:00", "Z")
|
|
67
69
|
)
|
|
68
70
|
|
|
69
71
|
|
|
@@ -350,6 +352,22 @@ class Plexus:
|
|
|
350
352
|
return int(timestamp * 1000)
|
|
351
353
|
return int(timestamp)
|
|
352
354
|
|
|
355
|
+
def _now_iso(self) -> str:
|
|
356
|
+
"""Now on the SERVER's clock, as ISO-8601.
|
|
357
|
+
|
|
358
|
+
Run boundaries have to be stamped on the same clock as the telemetry
|
|
359
|
+
they bound, and `_normalize_ts_ms` corrects generated timestamps by the
|
|
360
|
+
offset the gateway reports on connect. Reading the local clock here
|
|
361
|
+
instead — which this did — leaves `ended_at` behind every point taken
|
|
362
|
+
in the final `offset` milliseconds of the run, and those points then
|
|
363
|
+
fall outside the window their own run is evaluated over.
|
|
364
|
+
|
|
365
|
+
The failure is quiet and looks like something else entirely: on a
|
|
366
|
+
device running 58ms behind the server, a 300-point run was evaluated
|
|
367
|
+
over 284 of them, and the shortfall reads exactly like ingest lag.
|
|
368
|
+
"""
|
|
369
|
+
return _iso_from_ms(int(time.time() * 1000) + self._clock_offset_ms)
|
|
370
|
+
|
|
353
371
|
@staticmethod
|
|
354
372
|
def _infer_class(value: FlexValue) -> str:
|
|
355
373
|
"""Numbers are metrics; everything else (str/bool/dict/list) is an event.
|
|
@@ -584,7 +602,10 @@ class Plexus:
|
|
|
584
602
|
Returns:
|
|
585
603
|
The created run dict, including its "id".
|
|
586
604
|
"""
|
|
587
|
-
body: dict[str, Any] = {
|
|
605
|
+
body: dict[str, Any] = {
|
|
606
|
+
"name": name,
|
|
607
|
+
"started_at": started_at or self._now_iso(),
|
|
608
|
+
}
|
|
588
609
|
if source_id is not _USE_CLIENT_SOURCE:
|
|
589
610
|
body["source_id"] = source_id
|
|
590
611
|
else:
|
|
@@ -664,7 +685,7 @@ class Plexus:
|
|
|
664
685
|
return self._api(
|
|
665
686
|
"PATCH",
|
|
666
687
|
f"/api/runs/{run_id}",
|
|
667
|
-
{"status": status, "ended_at": ended_at or
|
|
688
|
+
{"status": status, "ended_at": ended_at or self._now_iso()},
|
|
668
689
|
)["run"]
|
|
669
690
|
|
|
670
691
|
@contextmanager
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
plexus/__init__.py,sha256=
|
|
1
|
+
plexus/__init__.py,sha256=aKzqSESaFXWQ2mQ6XnckTtAsezjyYj4UpxhJEkWeOhk,808
|
|
2
2
|
plexus/_log.py,sha256=3fjXrHFZghQ_17umMcvDUjjTH6aTQB3J4SpVDBiH03w,335
|
|
3
3
|
plexus/batching.py,sha256=mPMa3m9xK-DCwRmuyL_aqaTltimIOtwoDzz4PfKWyh8,10452
|
|
4
4
|
plexus/buffer.py,sha256=UNv_jEcrDwbkjJ6uhCehb7uBI2EuFEwO40waDpZn_5I,9579
|
|
5
5
|
plexus/cli.py,sha256=TenKqhvh7Z-JhAUj4kjogrRGA2Hlrfd3TvBFo4S5tlk,17633
|
|
6
|
-
plexus/client.py,sha256=
|
|
6
|
+
plexus/client.py,sha256=H69DR30pj3X8PiURZsViGTDHsIsQ2Kn4muHNECsioKw,53865
|
|
7
7
|
plexus/config.py,sha256=RuDh5UdVGdVQld5kQlXZO6CVXO4tS0HBalyaoAlXNvc,4416
|
|
8
8
|
plexus/ws.py,sha256=2kUCTPkS-tG1XpL9RAzTiytk4Dbck5ypqkbDRSKaTF8,19811
|
|
9
9
|
plexus/cameras/__init__.py,sha256=AVu1vE1xfYk9lz1cprHlTfi0ieHf84UhQh9Z92E05b8,490
|
|
@@ -12,8 +12,8 @@ plexus/_skills/README.md,sha256=9TNo9mssmBiBPkrYBiA2JJHWOIAEw6DvCWCYAvfzmjM,3243
|
|
|
12
12
|
plexus/_skills/plexus/SKILL.md,sha256=Q1ZYe9YH-gOhMcGYuMG5H9DkHMfQOr3OazCtlxtP9f8,13617
|
|
13
13
|
plexus/_skills/plexus-dashboard/SKILL.md,sha256=8xjdvI3orM31XHTLv1fSAWstCGMwt1HnEbo0SlpTxV4,9508
|
|
14
14
|
plexus/_skills/plexus-firmware/SKILL.md,sha256=IkUqNbg5sM5VaZEb189P_aOUkm9_PlSqd4JLH0Nv830,12081
|
|
15
|
-
plexus_python-0.11.
|
|
16
|
-
plexus_python-0.11.
|
|
17
|
-
plexus_python-0.11.
|
|
18
|
-
plexus_python-0.11.
|
|
19
|
-
plexus_python-0.11.
|
|
15
|
+
plexus_python-0.11.2.dist-info/METADATA,sha256=Cpqy4cAMWY7qa1J4ofKpGMVKkRCGAYDhLTDoFVp9vfI,13517
|
|
16
|
+
plexus_python-0.11.2.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
17
|
+
plexus_python-0.11.2.dist-info/entry_points.txt,sha256=YlkOtTn_7Q_IGuJaKdvpU-90dCeBSPx2p_UTGMAz5Zs,43
|
|
18
|
+
plexus_python-0.11.2.dist-info/licenses/LICENSE,sha256=nm3qP1F-JAGcfLpRVtIX24L20LMnRpxmZ2oKZzFpLVo,10755
|
|
19
|
+
plexus_python-0.11.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|