Quick Quality Test Utility: Pre-Session Environment Setup¶
Before joining the live 1-hour pairing session with a Modigie engineer, your technical team should prepare your local workstation or environment. This ensures you can execute the Python scripts seamlessly when running live evaluations.
What Modigie Prepares Ahead of Time¶
Ahead of the live session, Modigie engineers pre-configure your dedicated Google Cloud Pub/Sub evaluation environment:
- Tenant Project & Evaluation Repository: An isolated Modigie Pub/Sub repository deployed in our multi-tenant GCP cluster.
- Dedicated Pub/Sub Topics & Subscriptions: Request topics and pull subscriptions pre-created for all 5 job types.
- Service Account & IAM Permissions: Granted
roles/pubsub.publisherandroles/pubsub.subscriberto securely send job requests and retrieve completed results.
During the live session, Modigie will provide you with your tenantProjectId and repoShortId (and service account credentials if running locally).
Step 1: Verify Python Installation¶
The utility requires Python 3.9+ (Python 3.11+ is recommended). Verify your local Python version in your terminal:
If Python 3.9+ is not installed, install it from python.org or via your system package manager (e.g., brew install python@3.11 on macOS or apt install python3 on Ubuntu).
Step 2: Install Client Library Dependency¶
The utility uses the official Google Cloud Pub/Sub client library. Install it using pip:
(All other modules used by the scripts—json, csv, threading, concurrent.futures, dataclasses, and argparse—are part of the standard Python library.)
Step 3: Download Utility Assets¶
Download the three core Python scripts into a dedicated folder on your machine (e.g. quick_test_util/):
-
config.py— Centralized configuration definingUtilConfigwith dynamic Pub/Sub resource name resolution. -
publisher.py— Multi-job-type CSV reader, JSON preview generator, and Pub/Sub request publisher. -
subscriber.py— Streaming pull response listener that persists raw JSON files and flattens completed results into a consolidated CSV.
Your local working directory should look like this:
quick_test_util/
├── config.py
├── publisher.py
├── subscriber.py
└── sample_input_enrich_mobile.csv (or your prepared evaluation CSV)
Step 4: Run Pre-Flight Verification Checks¶
Confirm that the scripts can execute and display their help menus without dependency errors:
You should see the command-line arguments reference for both scripts without any ModuleNotFoundError or syntax warnings.
Step 5: Google Cloud Authentication¶
Depending on where you will execute the scripts during the live pairing session, choose one of the two authentication workflows below:
If executing from your local laptop or development server:
Option A — Application Default Credentials (Recommended if you have Google Cloud SDK):
Option B — Service Account Key File:
If you do not use Google Cloud SDK locally, Modigie can supply a temporary service account JSON key for your evaluation repository. You can supply it either via the CLI flag or environment variable:
# Option B1: Pass via CLI flag
python publisher.py --jobType=enrichMobile --credentials=/path/to/service-account-key.json --dryRun
# Option B2: Export environment variable
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
Option C — In-Memory Service Account JSON (Zero-Disk / CI/CD):
If you manage credentials via CI/CD secrets (e.g., GitHub Secrets, Vault) or prefer not persisting sensitive private key files to disk, export the JSON content directly as MODIGIE_CREDENTIALS_JSON. No extra packages are needed because google-cloud-pubsub already bundles google-auth:
# Option C1: Export from existing file without keeping it in your working directory
export MODIGIE_CREDENTIALS_JSON="$(cat /path/to/service-account-key.json)"
# Option C2: Paste JSON string directly (e.g., in CI/CD pipeline environment variables)
export MODIGIE_CREDENTIALS_JSON='{"type": "service_account", ...}'
If Modigie provisions a Cloud Workstation for your pairing session, no manual authentication or key downloading is needed:
- Python 3.11+, dependencies, and repository code are pre-installed.
- Application Default Credentials (ADC) are automatically acquired from the Cloud Workstation metadata server via its attached service account.
- You can proceed directly to running the scripts.
Next Step: Live Pairing Session¶
Once your environment is configured and your input CSV is ready:
Live Pairing Session Guide to review the execution runbook and output evaluation process.