Skip to main content

Merlin Batch Predictor

Merlin Batch Predictor is a PySpark application for running batch prediction job in Merlin system.

Usage

The application accept a yaml file for configuring source, model, and sink of the prediction job. The schema of the configuration file is described by the proto file. An example of the config file is as follow.

kind: PredictionJob
version: v1
name: integration-test
bigquerySource:
  table: "project.dataset.table_iris"
  features:
    - sepal_length
    - sepal_width
    - petal_length
    - petal_width
model:
  type: PYFUNC_V2
  uri: gs://bucket-name/e2e/artifacts/model
  result:
    type: DOUBLE
bigquerySink:
  table: "project.dataset.table_iris_result"
  result_column: "prediction"
  save_mode: OVERWRITE
  options:
    project: "project"
    temporaryGcsBucket: "bucket-name"

The above prediction job specification will read data from bigquery-public-data:samples.shakespeare Bigquery table, run prediction using a PYFUNC_V2 model located at gs://bucket-name/mlflow/6/2c3703fbbf9f4866b26e4cf91641f02c/artifacts/model GCS bucket, and write the result to another bigquery table project.dataset.table.

To start the application locally you need:

  • Set GOOGLE_APPLICATION_CREDENTIALS environment variable and point it to the service account which has following privileges:
    1. Storage Writer for the temporaryGcsBucket
    2. Storage Object Writer for temporaryGcsBucket
    3. BigQuery Job User
    4. BigQuery Read Session User
    5. BigQuery Data Reader from the source dataset
    6. BigQuery Data Editor for the destination dataset

Then you can invoke

python main.py --job-name <job-name> --spec-path <path-to-spec-yaml> --local

In mac OS you need to set OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES python main.py --job-name <job-name> --spec-path <path-to-spec-yaml> --local

For example

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES python main.py --job-name iris-prediction --spec-path sample/sample_1.yaml --local

Development

Requirements

Setup Dev Dependencies

make setup

Run all test

You need to set GOOGLE_APPLICATION_CREDENTIALS and point it to service account file which has following privileges:

  1. BigQuery Job User
  2. BigQuery Read Session User
  3. BigQuery Data Editor for dataset project:dataset
  4. Storage Writer for bucket-name bucket
  5. Storage Object Writer for bucket-name bucket
make test

Run only unit test

make unit-test

Metadata

Release files for merlin-batch-predictor 0.50.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for merlin-batch-predictor 0.50.0
File Size Uploaded Provenance Actions
merlin_batch_predictor-0.50.0.tar.gz 45.3 kB Without provenance Details for merlin_batch_predictor-0.50.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for merlin-batch-predictor 0.50.0
File Interpreter ABI Platform Actions
merlin_batch_predictor-0.50.0-py3-none-any.whl Python 3 none any Details for merlin_batch_predictor-0.50.0-py3-none-any.whl

Total release size: 64.3 kB

Release files / merlin_batch_predictor-0.50.0.tar.gz

Download URL merlin_batch_predictor-0.50.0.tar.gz
Size 45.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3645e0a8c4f7875fb3267bde18b11dffefaee411c047d60030b0ebbe1628bc16
BLAKE2b-256 checksum
How to use checksums
b4300ec6b6c336dc331836de7e81a83acc7516633ac4308d10fb1ed46562cb76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / merlin_batch_predictor-0.50.0-py3-none-any.whl

Download URL merlin_batch_predictor-0.50.0-py3-none-any.whl
Size 18.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20368c1011607863c8eb5aee65037d98f34b4055d7d6e40f4aa893123f4ce523
BLAKE2b-256 checksum
How to use checksums
160916539b7ec165fd18d858d47f5bbf2859028d781ad37df16efb2856f4f043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for merlin-batch-predictor 0.50.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.50.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page