ML Batch Predict 시드 절차 (#1358)
pipelines/gend_pipelines/ml/batch_predict_asset.py (Epic #1083) 의 ml_batch_demo_credit_risk_job E2E 실행에 필요한 시드 데이터 생성 절차.
시드 대상
- MLflow:
demo_credit_risk@Productionv1 (sklearn LogisticRegression, 3-feature) - Trino:
iceberg.silver.demo_customers(10 rows synthetic data)
한 줄 명령
# AKS prod (port-forward 필요)
kubectl --context aks-genos-prod -n gend port-forward svc/mlflow 5000:5000 &
kubectl --context aks-genos-prod -n gend port-forward svc/trino 8080:8080 &
MLFLOW_TRACKING_URI=http://localhost:5000 \
TRINO_HOST=localhost TRINO_PORT=8080 \
make seed-demo-ml
# kind datax-local (직접 in-cluster 호출 가능)
make seed-demo-ml
세부 옵션
# MLflow 만 시드 (Trino 제외)
make seed-demo-ml-mlflow
# Trino 만 시드 (MLflow 제외)
make seed-demo-ml-trino
# 직접 호출 (커스텀 옵션)
python scripts/seed_demo_credit_risk.py --n-train 5000 # 더 큰 학습셋
python scripts/seed_demo_credit_risk.py --quiet # 출력 억제
Dagster prod env 변수 (영구 적용)
ml_batch_demo_credit_risk_job 이 MLflow 아티팩트 다운로드 시 SeaweedFS S3 인증 필요. Dagster Helm values 또는 deployment env 에 영구 추가:
# infra/dagster/values.yaml (또는 deployment yaml)
extraEnvVarsSecret:
- name: seaweedfs-credentials # AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY
extraEnv:
- name: MLFLOW_S3_ENDPOINT_URL
value: http://seaweedfs.gend.svc.cluster.local:8333
수동 patch (운영자 사이클 #1346 에서 임시 적용한 패턴):
kubectl --context aks-genos-prod -n gend patch deploy dagster-webserver --type=json -p='[
{"op": "add", "path": "/spec/template/spec/containers/0/env/-",
"value": {"name": "AWS_ACCESS_KEY_ID", "valueFrom": {"secretKeyRef": {"name": "seaweedfs-credentials", "key": "AWS_ACCESS_KEY_ID"}}}},
{"op": "add", "path": "/spec/template/spec/containers/0/env/-",
"value": {"name": "AWS_SECRET_ACCESS_KEY", "valueFrom": {"secretKeyRef": {"name": "seaweedfs-credentials", "key": "AWS_SECRET_ACCESS_KEY"}}}},
{"op": "add", "path": "/spec/template/spec/containers/0/env/-",
"value": {"name": "MLFLOW_S3_ENDPOINT_URL", "value": "http://seaweedfs.gend.svc.cluster.local:8333"}}
]'
검증
# 1. MLflow registry 확인
curl http://mlflow.gend.svc.cluster.local:5000/api/2.0/mlflow/registered-models/get?name=demo_credit_risk
# 2. Trino 테이블 확인
trino --execute "SELECT COUNT(*) FROM iceberg.silver.demo_customers"
# Expected: 10
# 3. Dagster job 재실행 (시드 + env 적용 후)
curl -X POST http://dagster.gend.svc.cluster.local:3000/dagster/graphql \
-H "Content-Type: application/json" \
-d '{"query": "mutation { launchRun(executionParams: { selector: { repositoryLocationName: \"gend_pipelines:defs\", repositoryName: \"__repository__\", jobName: \"ml_batch_demo_credit_risk_job\" }, runConfigData: \"{}\", mode: \"default\" }) { __typename ... on LaunchRunSuccess { run { runId status } } } }"}'
# 4. ArangoDB lineage edge 확인 (성공 시)
# → mlflow.Production.demo_credit_risk → iceberg.gold.predictions_demo_credit_risk
트러블슈팅
| 증상 | 원인 | 해결 |
|---|---|---|
mlflow.RestException: alias Production not found | MLflow 시드 미실행 | make seed-demo-ml-mlflow |
botocore.NoCredentialsError | Dagster env 미설정 | 위 deployment patch 적용 |
trino.TrinoUserError TYPE_MISMATCH varchar vs integer | sink.py BIGINT 버그 (#1356) | PR #1393 머지 후 ACR 재빌드 |
EndpointConnectionError: Could not connect to seaweedfs | SeaweedFS service 이름 잘못 | seaweedfs.gend.svc.cluster.local:8333 (not -s3) |
INSERT: 0 rows | Trino Iceberg connector mis-config | trino-catalog ConfigMap 확인 |
관련
- 부모 Epic #1083
- 운영자 사이클 m3-final-summary.md
- 관련 follow-up: #1356, #1360