numaproj / numaflow-python

Numaflow Python SDK
Apache License 2.0
50 stars 17 forks source link

chore: use same server info for all map modes and refactor #185

Closed kohlisid closed 1 month ago

kohlisid commented 1 month ago

Fixes : #1837

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 78.37838% with 8 lines in your changes missing coverage. Please review.

Project coverage is 94.52%. Comparing base (5bbbe56) to head (f35c6bf).

Files Patch % Lines
pynumaflow/mapper/multiproc_server.py 33.33% 4 Missing :warning:
pynumaflow/info/types.py 92.00% 1 Missing and 1 partial :warning:
pynumaflow/mapper/sync_server.py 33.33% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #185 +/- ## ========================================== - Coverage 94.82% 94.52% -0.30% ========================================== Files 56 56 Lines 2184 2212 +28 Branches 130 131 +1 ========================================== + Hits 2071 2091 +20 - Misses 83 90 +7 - Partials 30 31 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

kohlisid commented 1 month ago

Map Stream with new map mode metadata

no annotations in spec

    - name: flatmap
      limits:
        readBatchSize: 1
      udf:
        container:
          image: quay.io/kohlisid/numaflow-python/map-flatmap-stream:stable1
          imagePullPolicy: Always

Map stream server with mapstream.sock

 skohli@macos-JQWR9T560R flatmap_stream % kubectl logs simple-pipeline-flatmap-0-nzluc -f  
+ python example.py
2024-07-16 21:03:01 INFO     Starting Map Stream Server
2024-07-16 21:03:01 INFO     Async GRPC Server listening on: unix:///var/run/numaflow/mapstream.sock with max threads: 4

Server info file - /var/run/numaflow/mapper-server-info

 kubectl logs simple-pipeline-flatmap-0-nzluc numa -f  | grep "mapper"
2024/07/16 21:02:43 Server info file /var/run/numaflow/mapper-server-info is not ready...

 kubectl logs simple-pipeline-flatmap-0-nzluc numa -f  | grep Info
2024/07/16 21:03:01 ServerInfo: &{uds python 1.2.0-rc4 0.7.3 map[MAP_MODE:stream-map]}

kubectl logs simple-pipeline-flatmap-0-nzluc numa -f  | grep "enabled"
2024-07-16T21:03:01.93051948Z   INFO    numaflow.MapUDF-processor       udf/map_udf.go:150      Map mode enabled: Stream Map    {"pipeline": "simple-pipeline", "vertex": "flatmap", "protocol": "uds-grpc-map-udf"}
kohlisid commented 1 month ago

Batch Map with new map mode metadata

no annotations in spec

    - name: batch-flatmap
      partitions: 2
      scale:
        min: 1
      udf:
        container:
          image: quay.io/kohlisid/numaflow-python/batch-map-flatmap:stable1
          imagePullPolicy: Always
2024/07/17 21:06:52 Server info file /var/run/numaflow/mapper-server-info is not ready...
2024/07/17 21:06:53 ServerInfo: &{uds python 1.2.0-rc4 0.7.3 map[MAP_MODE:batch-map]}
{"level":"info","ts":"2024-07-17T21:06:53.813018858Z","logger":"numaflow.MapUDF-processor","caller":"udf/map_udf.go:173","msg":"Map mode enabled: Batch Map","pipeline":"flatmap","vertex":"batch-flatmap","protocol":"uds-grpc-map-udf"}
2024/07/17 21:06:53 UDS Client: unix:/var/run/numaflow/batchmap.sock
kohlisid commented 1 month ago

Unary Map with new map mode metadata

no annotations in spec

    - name: flatmap
      udf:
        container:
          image: quay.io/kohlisid/numaflow-python/map-flatmap:stable
          imagePullPolicy: Always
          env:
            - name: PYTHONDEBUG
              value: "true"

2024/07/17 21:13:39 Server info file /var/run/numaflow/mapper-server-info is not ready..
2024-07-17T21:13:55.67101085Z   INFO    numaflow.MapUDF-processor       udf/map_udf.go:196      Map mode enabled: Unary Map     {"pipeline": "simple-pipeline", "vertex": "flatmap", "protocol": "uds-grpc-map-udf"} 
2024/07/17 21:13:55 ServerInfo: &{uds python 1.2.0-rc4 0.7.3 map[MAP_MODE:unary-map]}
2024/07/17 21:13:55 UDS Client: unix:/var/run/numaflow/map.sock
kohlisid commented 1 month ago

Unary Map with no metadata (older code + new numaflow backward)

no annotations in spec

    - name: flatmap
      udf:
        container:
          image: quay.io/kohlisid/numaflow-python/map-flatmap:stable
          imagePullPolicy: Always
          env:
            - name: PYTHONDEBUG
              value: "true"

2024/07/17 21:21:21 Server info file /var/run/numaflow/mapper-server-info is not ready...
2024/07/17 21:21:34 ServerInfo: &{uds python 1.2.0-rc4 0.7.3 map[]}
2024-07-17T21:21:34.368700528Z  INFO    numaflow.MapUDF-processor       udf/map_udf.go:196      Map mode enabled: Unary Map     {"pipeline": "simple-pipeline", "vertex": "flatmap", "protocol": "uds-grpc-map-udf"}
2024/07/17 21:21:34 UDS Client: unix:/var/run/numaflow/map.sock
kohlisid commented 1 month ago

Multiproc Map

2024-07-17T21:27:54.898644917Z  INFO    numaflow.MapUDF-processor       udf/map_udf.go:196      Map mode enabled: Unary Map     {"pipeline": "simple-pipeline", "vertex": "mult", "protocol": "uds-grpc-map-udf"}
2024/07/17 21:27:54 ServerInfo: &{uds python 1.2.0-rc4 0.7.3 map[CPU_LIMIT:6 MULTIPROC:3]}
2024/07/17 21:27:54 Multiprocessing Servers : 3
KeranYang commented 1 month ago

@kohlisid I am approving but it would be great if we make the codecov pass before merging.