Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sidhant Kohli <[email protected]>
  • Loading branch information
Sidhant Kohli committed Jul 8, 2024
1 parent e238dfc commit fb21149
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/batchmapper/examples/batchmap-flatmap/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ COPY dist/batchmap-flatmap /bin/batchmap-flatmap
RUN chmod +x /bin/batchmap-flatmap

####################################################################################################
# flatmap
# batchmap-flatmap
####################################################################################################
FROM scratch as flatmap
FROM scratch as batch-flatmap
ARG ARCH
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
Expand Down
4 changes: 2 additions & 2 deletions pkg/batchmapper/examples/batchmap-flatmap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ build:

.PHONY: image-push
image-push: build
docker buildx build -t ${IMAGE_REGISTRY} --platform linux/amd64,linux/arm64 --target flatmap . --push
docker buildx build -t ${IMAGE_REGISTRY} --platform linux/amd64,linux/arm64 --target batch-flatmap . --push

.PHONY: image
image: build
docker build -t ${IMAGE_REGISTRY} --target flatmap .
docker build -t ${IMAGE_REGISTRY} --target batch-flatmap .
@if [ "$(PUSH)" = "true" ]; then docker push ${IMAGE_REGISTRY}; fi

clean:
Expand Down
16 changes: 16 additions & 0 deletions pkg/batchmapper/examples/batchmap-flatmap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
An example User Defined Function that demonstrates how to write a batch map based `flatmap` User Defined Function.


To start a vertex in batch map mode we need to add the annotations as following
```yaml
- name: go-split
metadata:
annotations:
numaflow.numaproj.io/batch-map: "true"
scale:
min: 1
udf:
container:
# Split input message into an array with comma, see https://github.com/numaproj/numaflow-go/tree/main/pkg/batchmapper/examples/batchmap-flatmap
image: quay.io/numaio/numaflow-go/batch-map-flatmap:stable
imagePullPolicy: Always
```
Some considerations for batch map are as follows
- The user will have to ensure that the BatchResponse is tagged with the correct request ID as this will be used by Numaflow for populating information required for system correctness like MessageID for the ISB deduplication.
Expand Down
2 changes: 1 addition & 1 deletion pkg/batchmapper/examples/batchmap-flatmap/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
min: 1
udf:
container:
# Split input message into an array with comma, see https://github.com/numaproj/numaflow-go/tree/main/pkg/mapper/examples/flatmap
# Split input message into an array with comma, see https://github.com/numaproj/numaflow-go/tree/main/pkg/batchmapper/examples/batchmap-flatmap
image: quay.io/numaio/numaflow-go/batch-map-flatmap:stable
imagePullPolicy: Always
- name: go-udsink
Expand Down

0 comments on commit fb21149

Please sign in to comment.