dora-rs / dora

DORA (Dataflow-Oriented Robotic Architecture) is middleware designed to streamline and simplify the creation of AI-based robotic applications. It offers low latency, composable, and distributed dataflow capabilities. Applications are modeled as directed graphs, also referred to as pipelines.
https://dora-rs.ai
Apache License 2.0
1.5k stars 79 forks source link

Pretty Print Rust object when called from Python print #503

Closed haixuanTao closed 4 months ago

haixuanTao commented 4 months ago

This will make it possible to print dora event object within python for debugging purposes:

Ex:

print(dora_event)
Dora(
    Input {
        id: DataId(
            "image",
        ),
        metadata: Metadata {
            metadata_version: 0,
            timestamp: 664b45b2bfe51ff0/FC05639A0C7747D6BF87A894CEF83935,
            type_info: ArrowTypeInfo {
                data_type: UInt8,
                len: 65786,
                null_count: 0,
                validity: None,
                offset: 0,
                buffer_offsets: [
                    BufferOffset {
                        offset: 0,
                        len: 65786,
                    },
                ],
                child_data: [],
            },
            parameters: MetadataParameters {
                watermark: 0,
                deadline: 0,
                open_telemetry_context: "traceparent:00-392f4871c115bdaa8dd1e316187a03c5-55debb0964f25de8-01;tracestate:;",
            },
        },
        data: ArrowData(
            PrimitiveArray<UInt8>
            [
              255,
              216,
              255,
              224,
              0,
              16,
              74,
              70,
              73,
              70,
              ...65766 elements...,
              123,
              86,
              240,
              106,
              196,
              74,
              61,
              79,
              255,
              217,
            ],
        ),
    },
)