dreadnode 1.10.0__tar.gz → 1.11.0__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.
- {dreadnode-1.10.0 → dreadnode-1.11.0}/PKG-INFO +1 -1
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/__init__.py +6 -0
- dreadnode-1.11.0/dreadnode/convert.py +42 -0
- dreadnode-1.11.0/dreadnode/data_types/__init__.py +9 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/data_types/audio.py +2 -2
- dreadnode-1.11.0/dreadnode/data_types/base.py +49 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/data_types/image.py +2 -2
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/data_types/object_3d.py +2 -2
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/data_types/table.py +2 -2
- dreadnode-1.11.0/dreadnode/data_types/text.py +59 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/data_types/video.py +2 -2
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/main.py +88 -80
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/object.py +2 -2
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/serialization.py +30 -9
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/task.py +63 -46
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/tracing/span.py +211 -46
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/util.py +2 -2
- {dreadnode-1.10.0 → dreadnode-1.11.0}/pyproject.toml +2 -2
- dreadnode-1.10.0/dreadnode/data_types/__init__.py +0 -7
- dreadnode-1.10.0/dreadnode/data_types/base_data_type.py +0 -17
- {dreadnode-1.10.0 → dreadnode-1.11.0}/README.md +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/api/__init__.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/api/client.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/api/models.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/api/util.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/artifact/__init__.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/artifact/merger.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/artifact/storage.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/artifact/tree_builder.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/constants.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/integrations/__init__.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/integrations/transformers.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/metric.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/py.typed +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/tracing/__init__.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/tracing/constants.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/tracing/exporters.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/types.py +0 -0
- {dreadnode-1.10.0 → dreadnode-1.11.0}/dreadnode/version.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from dreadnode import convert, data_types
|
|
1
2
|
from dreadnode.data_types import Audio, Image, Object3D, Table, Video
|
|
2
3
|
from dreadnode.main import DEFAULT_INSTANCE, Dreadnode
|
|
3
4
|
from dreadnode.metric import Metric, MetricDict, Scorer
|
|
@@ -33,6 +34,7 @@ log_artifact = DEFAULT_INSTANCE.log_artifact
|
|
|
33
34
|
__version__ = VERSION
|
|
34
35
|
|
|
35
36
|
__all__ = [
|
|
37
|
+
"DEFAULT_INSTANCE",
|
|
36
38
|
"Audio",
|
|
37
39
|
"Dreadnode",
|
|
38
40
|
"Image",
|
|
@@ -51,6 +53,10 @@ __all__ = [
|
|
|
51
53
|
"__version__",
|
|
52
54
|
"api",
|
|
53
55
|
"configure",
|
|
56
|
+
"continue_run",
|
|
57
|
+
"convert",
|
|
58
|
+
"data_types",
|
|
59
|
+
"get_run_context",
|
|
54
60
|
"link_objects",
|
|
55
61
|
"log_artifact",
|
|
56
62
|
"log_input",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
|
|
3
|
+
if t.TYPE_CHECKING:
|
|
4
|
+
import networkx as nx # type: ignore [import-untyped]
|
|
5
|
+
|
|
6
|
+
from dreadnode.tracing.span import RunSpan
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def run_span_to_graph(run: "RunSpan") -> "nx.DiGraph":
|
|
10
|
+
try:
|
|
11
|
+
import networkx as nx
|
|
12
|
+
except ImportError as e:
|
|
13
|
+
raise RuntimeError("The `networkx` package is required for graph conversion") from e
|
|
14
|
+
|
|
15
|
+
graph = nx.DiGraph()
|
|
16
|
+
|
|
17
|
+
graph.add_node(
|
|
18
|
+
run.run_id,
|
|
19
|
+
name=run.name,
|
|
20
|
+
label=run.label,
|
|
21
|
+
start_time=run.start_time,
|
|
22
|
+
end_time=run.end_time,
|
|
23
|
+
duration=run.duration,
|
|
24
|
+
status="failed" if run.failed else "running" if run.is_recording else "completed",
|
|
25
|
+
tags=run.tags,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
for task in run.all_tasks:
|
|
29
|
+
graph.add_node(
|
|
30
|
+
task.span_id,
|
|
31
|
+
name=task.name,
|
|
32
|
+
label=task.label,
|
|
33
|
+
start_time=task.start_time,
|
|
34
|
+
end_time=task.end_time,
|
|
35
|
+
duration=task.duration,
|
|
36
|
+
status="failed" if task.failed else "running" if task.active else "completed",
|
|
37
|
+
tags=task.tags,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
graph.add_edge(task.parent_task.span_id if task.parent_task else run.run_id, task.span_id)
|
|
41
|
+
|
|
42
|
+
return graph
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from .audio import Audio
|
|
2
|
+
from .base import WithMeta
|
|
3
|
+
from .image import Image
|
|
4
|
+
from .object_3d import Object3D
|
|
5
|
+
from .table import Table
|
|
6
|
+
from .text import Code, Markdown, Text
|
|
7
|
+
from .video import Video
|
|
8
|
+
|
|
9
|
+
__all__ = ["Audio", "Code", "Image", "Markdown", "Object3D", "Table", "Text", "Video", "WithMeta"]
|
|
@@ -9,12 +9,12 @@ try:
|
|
|
9
9
|
except ImportError:
|
|
10
10
|
sf = None
|
|
11
11
|
|
|
12
|
-
from dreadnode.data_types.
|
|
12
|
+
from dreadnode.data_types.base import DataType
|
|
13
13
|
|
|
14
14
|
AudioDataType: t.TypeAlias = str | Path | np.ndarray[t.Any, t.Any] | bytes
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class Audio(
|
|
17
|
+
class Audio(DataType):
|
|
18
18
|
"""
|
|
19
19
|
Audio media type for Dreadnode logging.
|
|
20
20
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DataType(ABC):
|
|
6
|
+
"""Base class for dedicated data types that can be logged with Dreadnode."""
|
|
7
|
+
|
|
8
|
+
@abstractmethod
|
|
9
|
+
def to_serializable(self) -> tuple[t.Any, dict[str, t.Any]]:
|
|
10
|
+
"""
|
|
11
|
+
Convert the media type to a serializable format.
|
|
12
|
+
|
|
13
|
+
Returns:
|
|
14
|
+
Tuple of (data, metadata) where:
|
|
15
|
+
- data: The serialized data
|
|
16
|
+
- metadata: Additional metadata for this data type
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class WithMeta(DataType):
|
|
21
|
+
"""
|
|
22
|
+
Helper data type to add additional metadata to the schema for logged data.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
```
|
|
26
|
+
log_output("my_data", WithMeta(data, {"format": "custom-data"}))
|
|
27
|
+
```
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, obj: t.Any, metadata: dict[str, t.Any]):
|
|
31
|
+
"""
|
|
32
|
+
Initialize a data type with associated metadata.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
metadata: The metadata for this data type
|
|
36
|
+
"""
|
|
37
|
+
self._obj = obj
|
|
38
|
+
self._metadata = metadata
|
|
39
|
+
|
|
40
|
+
def to_serializable(self) -> tuple[t.Any, dict[str, t.Any]]:
|
|
41
|
+
"""
|
|
42
|
+
Convert the media type to a serializable format.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
Tuple of (data, metadata) where:
|
|
46
|
+
- data: The serialized data
|
|
47
|
+
- metadata: Additional metadata for this data type
|
|
48
|
+
"""
|
|
49
|
+
return self._obj, self._metadata
|
|
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
|
|
8
|
-
from dreadnode.data_types.
|
|
8
|
+
from dreadnode.data_types.base import DataType
|
|
9
9
|
|
|
10
10
|
try:
|
|
11
11
|
from PIL import Image as PILImage
|
|
@@ -16,7 +16,7 @@ ImageDataType = t.Any | np.ndarray[t.Any, t.Any]
|
|
|
16
16
|
ImageDataOrPathType = str | Path | bytes | ImageDataType
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
class Image(
|
|
19
|
+
class Image(DataType):
|
|
20
20
|
"""
|
|
21
21
|
Image media type for Dreadnode logging.
|
|
22
22
|
|
|
@@ -2,12 +2,12 @@ import typing as t
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import ClassVar
|
|
4
4
|
|
|
5
|
-
from dreadnode.data_types.
|
|
5
|
+
from dreadnode.data_types.base import DataType
|
|
6
6
|
|
|
7
7
|
Object3DDataType = str | Path | bytes
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class Object3D(
|
|
10
|
+
class Object3D(DataType):
|
|
11
11
|
"""
|
|
12
12
|
3D object media type for Dreadnode logging.
|
|
13
13
|
|
|
@@ -6,14 +6,14 @@ from typing import ClassVar
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
import pandas as pd
|
|
8
8
|
|
|
9
|
-
from dreadnode.data_types.
|
|
9
|
+
from dreadnode.data_types.base import DataType
|
|
10
10
|
|
|
11
11
|
TableDataType = (
|
|
12
12
|
pd.DataFrame | dict[t.Any, t.Any] | list[t.Any] | str | Path | np.ndarray[t.Any, t.Any]
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
class Table(
|
|
16
|
+
class Table(DataType):
|
|
17
17
|
"""
|
|
18
18
|
Table data type for Dreadnode logging.
|
|
19
19
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
|
|
3
|
+
from dreadnode.data_types.base import DataType
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Text(DataType):
|
|
7
|
+
"""
|
|
8
|
+
Text data type for Dreadnode logging.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, text: str, format: str):
|
|
12
|
+
"""
|
|
13
|
+
Initialize a Text object.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
text: The text content to log
|
|
17
|
+
format: The format hint of the text
|
|
18
|
+
"""
|
|
19
|
+
self._text = text
|
|
20
|
+
self._format = format
|
|
21
|
+
|
|
22
|
+
def to_serializable(self) -> tuple[str, dict[str, t.Any]]:
|
|
23
|
+
return self._text, {"format": self._format}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Markdown(Text):
|
|
27
|
+
"""
|
|
28
|
+
Hint type for markdown-formatted text.
|
|
29
|
+
|
|
30
|
+
This is a subclass of Text with format set to "markdown".
|
|
31
|
+
|
|
32
|
+
Example:
|
|
33
|
+
```
|
|
34
|
+
log_output("report", Markdown("..."))
|
|
35
|
+
```
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, text: str):
|
|
39
|
+
super().__init__(text, format="markdown")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Code(Text):
|
|
43
|
+
"""
|
|
44
|
+
Hint type for code-formatted text.
|
|
45
|
+
|
|
46
|
+
This is a subclass of Text with format set to "code".
|
|
47
|
+
|
|
48
|
+
Example:
|
|
49
|
+
```
|
|
50
|
+
log_output("code_snippet", Code("print('Hello, World!')", language="python"))
|
|
51
|
+
```
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def __init__(self, text: str, language: str = ""):
|
|
55
|
+
super().__init__(text, format="code")
|
|
56
|
+
self._language = language
|
|
57
|
+
|
|
58
|
+
def to_serializable(self) -> tuple[str, dict[str, t.Any]]:
|
|
59
|
+
return self._text, {"format": self._format, "code-language": self._language}
|
|
@@ -6,7 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
import numpy as np
|
|
7
7
|
from numpy.typing import NDArray
|
|
8
8
|
|
|
9
|
-
from dreadnode.data_types.
|
|
9
|
+
from dreadnode.data_types.base import DataType
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip # type: ignore # noqa: PGH003
|
|
@@ -19,7 +19,7 @@ except ImportError:
|
|
|
19
19
|
VideoDataType: t.TypeAlias = str | Path | NDArray[t.Any] | bytes | list[NDArray[t.Any]] | t.Any
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
class Video(
|
|
22
|
+
class Video(DataType):
|
|
23
23
|
"""
|
|
24
24
|
Video media type for Dreadnode logging.
|
|
25
25
|
|