Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,19 @@ ENVIRONMENT=prod python src/ml_pipelines_kfp/iris_xgboost/pipelines/iris_pipelin

Predictions are written to `ml_dataset.iris_predictions`.

### 5. Real-time Streaming Inference
### 5. Streaming Feature Ingestion

Deploy a Dataflow streaming job that ingests Pub/Sub messages into the Feature Store (dual-writes to BQ offline store and Bigtable online store):

```bash
# Staging
./scripts/deploy_dataflow_feature.sh staging

# Production
./scripts/deploy_dataflow_feature.sh prod
```

### 6. Real-time Streaming Inference

Deploy a Dataflow streaming job for real-time inference:

Expand All @@ -192,12 +204,20 @@ Deploy a Dataflow streaming job for real-time inference:
./scripts/deploy_dataflow_streaming.sh prod
```

Start generating test data:
### 7. Publish Pub/Sub Test Events

Generate random Iris data and publish to Pub/Sub for testing streaming pipelines:

```bash
python src/ml_pipelines_kfp/iris_xgboost/pubsub_producer.py --project-id=deeplearning-sahil
# Default: batch_size=10, delay=5s, runs indefinitely
./scripts/run_pubsub_producer.sh

# Custom: batch_size=20, delay=2s, duration=60s
./scripts/run_pubsub_producer.sh 20 2 60
```

This can be run from any directory — the script resolves paths automatically.

## Development

### Code Quality
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy_dataflow_feature.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ echo "Environment: $ENV"
echo "Monitor at: https://console.cloud.google.com/dataflow/jobs/$REGION/$JOB_NAME?project=$PROJECT_ID"
echo ""
echo "To test the pipeline:"
echo "1. Publish messages: python src/ml_pipelines_kfp/iris_xgboost/pubsub_producer.py --project-id=$PROJECT_ID"
echo "1. Publish messages: ./scripts/run_pubsub_producer.sh"
echo "2. Check feature table: SELECT * FROM ml_dataset.iris_features WHERE source = 'streaming'"
echo ""
echo "To stop the job:"
Expand Down
4 changes: 3 additions & 1 deletion scripts/run_pubsub_producer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Generate random Iris data and publish to Pub/Sub for streaming inference testing
set -e

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

PROJECT_ID="deeplearning-sahil"
TOPIC="iris-inference-data"
BATCH_SIZE=${1:-10}
Expand All @@ -22,7 +24,7 @@ if [ -n "$DURATION" ]; then
DURATION_ARG="--duration $DURATION"
fi

python scripts/pubsub_producer.py \
python "$SCRIPT_DIR/pubsub_producer.py" \
--project-id "$PROJECT_ID" \
--topic "$TOPIC" \
--batch-size "$BATCH_SIZE" \
Expand Down
Loading