Prefect Runbook (K8s Dev Worker)
This runbook describes the current Prefect workflow for rapid in-cluster development.
Current Model
prefect-serverruns inside the namespace and exposes API/UI on port4200.prefect-dev-workerruns as a long-lived worker pod using work pooldev-process(processtype).- Deployments in
prefect.yamlrungit_cloneon each flow run, so code is pulled from Git (branchdev) instead of baked/appsource.
This means you do not need to rebuild the image for normal code changes; commit and push is enough.
Required Components
- Helm release with Prefect enabled and secret injection configured.
- A
dev-processwork pool in Prefect. - Valid Oracle credentials in
secrets.existingSecret(e.g.specify-secret). - S3 report uploads: Flows such as Migrate Users and Migrate MUSIT Actors only write
report.jsonwhenS3_BUCKETis set (plus S3/MinIO credentials). Reports useS3_MIGRATION_REPORTS_PREFIX(defaultmigration-reports), notS3_PREFIX/oracle-schema. IfS3_BUCKETis absent, runs succeed butreport_uploadedisfalse— see Migration reports on S3. - Migration image containing runtime dependencies:
prefectpython-oracledbwith Oracle Instant Client for thick mode
Helm Configuration Notes
In charts/specify7/staging.values.yaml:
prefect.server.enabled: trueprefect.devWorker.enabled: trueprefect.devWorker.workPool: "dev-process"prefect.devWorker.image.*points to your migration image tag.secrets.existingSecretpoints to the env secret with Oracle and Prefect vars.
Daily Dev Loop
- Start API access:
kubectl port-forward svc/specify7-prefect-server 4200:4200
- In another terminal:
source .venv/bin/activate
export PREFECT_API_URL=http://127.0.0.1:4200/api
-
Commit and push code changes to
dev(the branch configured inprefect.yaml). -
Register/update deployment:
prefect deploy --all
Non-interactive deploys: This repo includes a root prefect.toml with [cli] prompt = false, so Prefect loads PREFECT_CLI_PROMPT=false when your shell’s current working directory is the project root (see prefect config view). You should not get per-deployment confirmation prompts. If you run Prefect from elsewhere, either cd into the repo first, use an explicit flag, or set the variable for that shell:
prefect deploy --no-prompt --all
# or
PREFECT_CLI_PROMPT=false prefect deploy --all
To persist the setting in a Prefect profile instead of prefect.toml, use prefect config set PREFECT_CLI_PROMPT=false (writes to the active profile; see Settings and profiles).
- Run PROD connectivity check (Oracle + S3 preflight):
prefect deployment run "Infrastructure Prod Check/infrastructure-prod-check-dev"
Optional: run Oracle schema snapshot export (uploads JSON/CSV to S3):
prefect deployment run "Oracle Schema Snapshot/oracle-schema-snapshot-dev"
Schema snapshot artifacts include schema_catalog.json, CSV extracts, and schema.dbml.
Optional: sync Specify hierarchy from YAML (post-bootstrap, idempotent; default is dry run):
prefect deployment run "Sync Specify structure/sync-specify-structure-dev" --param dry_run=false
See Specify structure sync for the YAML format and recorded outcomes.
Optional: migrate MUSIT ACTOR + PERSON_NAME into Specify Agent (Phase 1.1; default is dry run):
prefect deployment run "Migrate MUSIT Actors/migrate-musit-agents-dev"
See MUSIT collection agents migration for parameters and scope.
Optional: migrate application users from Oracle USD_METADATA into Specify SpecifyUser + Agent (Phase 1.4; default is dry run):
prefect deployment run "Migrate Users/migrate-users-dev" --param dry_run=false
See User migration report for the report format and recorded outcomes.
- Inspect results:
prefect flow-run ls
prefect flow-run logs <FLOW_RUN_ID>
kubectl logs -f -l component=prefect-dev-worker
Known Oracle Failure Patterns
-
DPY-6005 ... [Errno 111] Connection refused
Network path or listener is not reachable from the cluster. -
DPY-6001 ... service is not registered (ORA-12514-like)
Host/port are reachable, butORACLE_*_SERVICEis wrong for that listener. -
DPY-3001 ... only supported in thick mode
Server requires native network encryption/integrity; thick mode is required. -
DPI-1047 ... cannot locate libclntsh.so
Oracle Instant Client library is missing/invisible in image or stale image tag is still running. -
S3 upload errors
VerifyS3_BUCKET, credentials, endpoint/region, and path-style settings in your secret. For MinIO/proxy setups withXAmzContentSHA256Mismatch, setS3_PAYLOAD_SIGNING_ENABLED=false.
Practical Tips
- Use explicit image tags (not only
latest) for reproducibility. - Keep
prefect.yamlpull branch aligned with your active branch. - If runs are stuck in
Scheduled, verify worker health and in-namespace connectivity toprefect-server:4200.