<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Siddharth Suri on Medium]]></title>
        <description><![CDATA[Stories by Siddharth Suri on Medium]]></description>
        <link>https://medium.com/@sidspwc?source=rss-44ef00b59485------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bfB3J5CK1hMOtq-_</url>
            <title>Stories by Siddharth Suri on Medium</title>
            <link>https://medium.com/@sidspwc?source=rss-44ef00b59485------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:08:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sidspwc/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Trigger Event Processing from Big Query using GCP Eventarc and Cloud Functions]]></title>
            <link>https://medium.com/@sidspwc/trigger-event-processing-from-big-query-using-gcp-eventarc-and-cloud-functions-c1c420b3e0df?source=rss-44ef00b59485------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1c420b3e0df</guid>
            <dc:creator><![CDATA[Siddharth Suri]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 14:05:38 GMT</pubDate>
            <atom:updated>2023-08-28T14:05:38.485Z</atom:updated>
            <content:encoded><![CDATA[<p>Eventarc is an eventing platform on Google Cloud that can connect Cloud Run services to events from various sources without having to implement, customize, or maintain the underlying infrastructure while managing delivery, security, authorization, observability, and error handling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pGE-cbOLgO7adYj2-ym3RQ.png" /><figcaption>Fig: Eventarc architecture</figcaption></figure><p>In this article, we will learn how to trigger Event Processing from Big Query using Eventarc and Cloud Functions. The cloud function in turn triggers a ML data pipeline by deploying the compiled version of the kubeflow pipeline on Vertex AI. This can come handy when you want to trigger a ML pipeline once the dependent BQ tables are refreshed with new data.</p><p><strong>First I will create a dummy table in BQ.</strong></p><p><em>create table `stunning-chain-351221.event_arc_demo.</em><strong><em>employee</em></strong><em>` (</em></p><p><em>first_name STRING,</em></p><p><em>last_name STRING,</em></p><p><em>department STRING,</em></p><p><em>phone_number INT64</em></p><p><em>);</em></p><p>Next, we will manually insert a row.</p><p><em>insert into event_arc_demo.employee values (‘John’, ‘Doe’, ‘IT’, 123456789)</em></p><p><strong>Step 1:</strong> Filter for BQ audit logs in Cloud Logging. You should see the latest log.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*351xsO5ulSF-xbNkdE9xBA.png" /><figcaption>Fig: Cloud Logging Audit Logs</figcaption></figure><p>The method is <strong>google.cloud.bigquery.v2.JobService.InsertJob</strong></p><p>The name of the table being inserted to is the <strong>protoPayload.resourceName</strong></p><p>The dataset id is available as <strong>resource.labels.dataset_id</strong></p><p>These are the parameters that will be used while creating a CF.</p><p>Make a note of the table name as we will need it in the next step</p><p><em>resourceName: “projects/inlaid-citron-362401/datasets/event_arc_demo/tables/employee”</em></p><p>Go to Cloud Function</p><p><strong>Step 2:</strong> Click Create a Function</p><p>Enable all APIs as needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*1rijW4DJeJxdAJixQm1m2w.png" /></figure><p><strong>Step 3</strong>: Select 2nd gen and click on ADD EVENTARC TRIGGER</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c13VSDMnPIqhBFZOBIJ7Zg.png" /></figure><p><strong>Step 4:</strong></p><p>Enable eventarc API</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*A-im1c291cTta1khuu0TXQ.png" /></figure><p>Fill in the values from drop-down and click on GRANT wherever needed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZ8G7K_zXgnWFPP3SJkULw.png" /></figure><p>Click on Next.</p><p>It will ask you to enable a couple more</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*5K8qJyZwQ7e4SxB20bSHZw.png" /></figure><p>When you deploy your function’s source code to Cloud Functions, that source is stored in a Cloud Storage bucket. Cloud Build then automatically builds your code into a container image and pushes that image to an <a href="https://cloud.google.com/functions/docs/building#image_registry_options">image registry</a> (either Container Registry or Artifact Registry). Cloud Functions accesses this image when it needs to run the container to execute your function.</p><p>The process of building the image is entirely automatic and requires no direct input from you. All the resources used in the build process execute in your own user project.</p><p>Cloud Run will be triggered when BigQuery writes to its audit log that in turn executes the function (and our data pipeline on Vertex AI)</p><p>On the next page, choose python 3.8 as the runtime env</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrdMzm-En7unlMCEH6FzuA.png" /></figure><p><strong>Copy the main.py as below (customize based on your requirement)</strong></p><p><em>import functions_framework</em></p><p><em>import base64</em></p><p><em>import json</em></p><p><em>from google.cloud import aiplatform</em></p><p><em>@functions_framework.cloud_event</em></p><p><em>def hello_auditlog(cloudevent):</em></p><p><em>payload_json={</em></p><p><em>“pipeline_spec_uri”: “gs://&lt;bucket_name&gt;/&lt;compiled json file name&gt;”, #CF triggers the ML pipeline by passing the json payload</em></p><p><em>“parameter_values”: {</em></p><p><em>“Parm1”: “Parm1”</em></p><p><em>}</em></p><p><em>}</em></p><p><em>trigger_pipeline_run(payload_json)</em></p><p><em>def trigger_pipeline_run(payload_json):</em></p><p><em>PROJECT_ID = ‘ inlaid-citron-362401’</em></p><p><em>REGION = “us-central1”</em></p><p><em>PIPELINE_ROOT = ‘gs://&lt;bucket_name&gt;’</em></p><p><em>pipeline_spec_uri = payload_json[‘pipeline_spec_uri’]</em></p><p><em>parameter_values = payload_json[‘parameter_values’]</em></p><p><em>aiplatform.init(</em></p><p><em>project=PROJECT_ID,</em></p><p><em>location=REGION,</em></p><p><em>)</em></p><p><em>job = aiplatform.PipelineJob( #submits job on Vertex AI</em></p><p><em>display_name=f’ML Pipeline’,</em></p><p><em>template_path=’gs://&lt;bucket_name&gt;/&lt;compiled json file name&gt;’,</em></p><p><em>pipeline_root=PIPELINE_ROOT,</em></p><p><em>parameter_values=parameter_values,</em></p><p><em>enable_caching=true,</em></p><p><em>)</em></p><p><em>job.submit()</em></p><p><em>return “Job submitted”</em></p><p><strong>Copy the below for requirements.txt</strong></p><p><em>functions-framework==3.*</em></p><p><em>google-api-python-client&gt;=1.7.8,&lt;2</em></p><p><em>google-cloud-aiplatform</em></p><p><em>pyyaml</em></p><p><strong>Step 5:</strong> Click Deploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*atMi2N0pKEXcSxzwDroqlA.png" /></figure><p>It takes a few minutes to deploy the function</p><p><strong>Step 6:</strong> Once the function is deployed, you can test it by inserting a new row in the BQ table.</p><p><em>insert into event_arc_demo.employee values (‘Jane’, ‘Doe’, ‘Finance’, 987654321)</em></p><p>As soon as the new row is inserted, you should see your ML pipeline triggered on Vertex AI.</p><p>In the backend you should see the following artifacts created-</p><ol><li>New buckets in Cloud storage</li><li>A docker Image in Artifact Registry</li><li>A Pub/Sub topic</li><li>A Cloud Run service</li></ol><h3>Summary</h3><p>In this article, I have documented how to trigger Event Processing from Big Query using Eventarc and Cloud Functions</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1c420b3e0df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Production-Ready MLOps Framework Using VertexAI]]></title>
            <link>https://medium.com/@sidspwc/build-a-production-ready-mlops-framework-using-vertexai-dd3e566fa9b6?source=rss-44ef00b59485------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd3e566fa9b6</guid>
            <dc:creator><![CDATA[Siddharth Suri]]></dc:creator>
            <pubDate>Mon, 14 Nov 2022 18:32:40 GMT</pubDate>
            <atom:updated>2022-11-14T18:32:40.614Z</atom:updated>
            <content:encoded><![CDATA[<h4>Your first step in establishing an MLOps practice and operationalizing ML systems.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QNfDpguPvMN-m5aSonBFiA.png" /></figure><p>A machine learning operations (MLOps) framework enables machine learning to build and deploy at scale by simplifying machine learning (ML) design, training, testing, deployment, and performance monitoring. MLOps systems combine proven DevOps concepts such as continuous integration and continuous delivery (CI/CD) with more data and ML-specific concepts such as “feature store” and “model monitoring”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LwG1_voUNDkFiUhg" /><figcaption>Photo by <a href="https://unsplash.com/@hiteshchoudhary?utm_source=medium&amp;utm_medium=referral">Hitesh Choudhary</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, we’ll cover the following steps and services involved in buildingthe MLOps framework using Google Cloud’s Vertex AI offering:</p><ul><li>Code-driven MLOps framework for data ingest, data prep, model training, model retraining, model deployment, model monitoring, and much more</li><li>ML pipelines automation</li><li>CI/CD framework for deploying the pipelines to production</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JN1X5KYHGh5yiHQ0lTzXVA.png" /><figcaption><a href="https://services.google.com/fh/files/misc/practitioners_guide_to_mlops_whitepaper.pdf">End to end MLOps flow</a></figcaption></figure><p><strong>Getting started</strong></p><p>To develop a code-driven MLOps framework, it is important to separate the model code from the operations (“ops”) code and develop the system outside a notebook environment. We want to establish a system in which the availability of new data triggers a retrain for the ML model. And the availability of a new implementation of the ML pipeline (including a new model architecture or feature engineering) will trigger a deployment and re-execution of the new ML pipeline using CI/CD.</p><p>To develop an MLOps system on Google Cloud, we used the following Google Cloud resources:</p><ol><li><em>Source repo</em></li><li><em>Cloud Build</em></li><li><em>Vertex AI Workbench managed notebooks</em></li><li><em>Vertex AI pipelines (managed Kubeflow pipelines)</em></li><li><em>Artifact Registry</em></li><li><em>Google Cloud Storage</em></li><li><em>BigQuery</em></li><li><em>Vertex AI Model Registry</em></li><li><em>Vertex AI Metadata</em></li><li><em>Cloud Functions</em></li><li><em>Cloud Scheduler</em></li><li><em>Vertex AI Feature Store</em></li></ol><h3><strong>Building your MLOps system</strong></h3><p><strong>Step 1: Prep your data.</strong></p><p>This step includes performing all data extraction, preprocessing, and feature engineering needed for your model and ingest them into the Vertex AI Feature Store.</p><p><em>Tip: Separate out each function as a Kubeflow component (e.g. separate Python functions).</em></p><p><strong>Step 2: Develop the model.</strong></p><p>Choose the appropriate ML algorithm. Build and train the model. Register in the Vertex AI Model Registry and deploy it to any Vertex AI endpoint to serve online use cases or batch predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgyGrOUoWi_ZKkeJlffxVA.png" /><figcaption><a href="https://services.google.com/fh/files/misc/practitioners_guide_to_mlops_whitepaper.pdf">Data and Model train pipelines</a></figcaption></figure><p><strong>Step 3: Develop your pipeline.</strong></p><p><strong>Step 3: Develop your pipeline.</strong></p><p>We recommend using Vertex AI Pipelines to orchestrate the steps of your ML workflow. This feature is heavily based on Kubeflow and uses the Kubeflow Pipelines python package (KFP) to define the pipelines. Running a pipeline consists of three tasks:</p><p><strong>A) Define the steps. </strong>A pipeline is made up of various steps called ‘components’. A pipeline component (reusable) is self-contained code that is packaged into a Docker container. There are a few different options for defining components:</p><ul><li>Docker images</li><li>Decorators</li><li>Converting functions</li></ul><p>We will define all of the steps of our ML workflow in separate Python functions and convert each of our functions into a component that will be used by Vertex AI Pipelines.</p><p><strong>B) Arrange the steps into a pipeline. </strong>Take the steps (components) defined in task <strong>A)</strong> and wrap them into a function with a pipeline decorator.</p><p>We will specify dependencies between steps and Vertex AI Pipelines and define the correct order for pipeline orchestration. We will also set memory and CPU requirements for individual steps. Why? So that if one step requires a large amount of memory or number of CPUs, Vertex AI Pipelines provisions a compute instance sufficient to perform that step.</p><p><strong>C) Compile and run the pipeline. </strong>The compile function packages your pipeline. When you invoke the pipeline run, you can pass in various arguments that are used by your pipeline. You can also specify configurations, such as whether to enable caching to accelerate pipeline runs and which service account to use when running the pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*g7pSlgA-F7ysO4F75RWldQ.png" /><figcaption><a href="https://cloud.google.com/architecture/architecture-for-mlops-using-tfx-kubeflow-pipelines-and-cloud-build#ml-with-kubeflow-pipelines">Reference Kubeflow pipeline</a></figcaption></figure><p><strong>Step 4: Create a Cloud Build flow (automated deployments of Vertex AI Pipelines CI/CD).</strong></p><p>Cloud Build is a service that executes CI/CD routines on Google Cloud infrastructure. In Vertex AI, Cloud Build is used to build, test, and deploy machine learning pipelines. Each build step is run in a Docker container. The following tasks will be executed as part of your Cloud Build flow:</p><p><strong>A)</strong> Clone the source repo</p><p><strong>B)</strong> Run unit tests</p><p><strong>C)</strong> Build the component images (Docker container images)</p><p><strong>D)</strong> Push the images to Artifact Registry</p><p><strong>E)</strong> Compile your pipeline</p><p><strong>F)</strong> Upload compiled JSON files to Google Cloud Storage</p><p><strong>G)</strong> Deploy and run your pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*CLsqlKiXejptvo1t9jkUYA.jpeg" /><figcaption>Cloud Build steps</figcaption></figure><p>We will have build routines (Cloud Build configuration files) that will be executed in response to different triggers.</p><p>To create a Docker image, your component file should have the following:</p><ul><li><strong>Dockerfile — </strong>the Docker daemon runs the instructions in the Dockerfile one by one, committing the result of each instruction to a new image, if necessary, outputting the ID of your new image. The Docker daemon will automatically clean up the context you sent.</li><li><strong>component.yaml — </strong>a<strong> </strong>component specification takes the form of a YAML file and describes the container component data model for Kubeflow Pipelines. The data model is serialized to a file in YAML format for sharing.</li><li><strong>python function</strong> — the actual code (.py file).</li><li><strong>requirements.txt</strong> — includes packages to install for the python function.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQkYMWIFR2e1DLbVhQPxCw.jpeg" /><figcaption><em>Docker build flow</em></figcaption></figure><p>Create the Cloud Build triggers to push the component images to the Artifact Registry. There will be a trigger created for each environment, including:</p><p><strong>A)</strong> trigger to deploy the terraform code</p><p><strong>B) </strong>trigger to deploy the components</p><p><strong>C)</strong> trigger to deploy the pipelines</p><p>Each Cloud Build will be triggered after pushing the respective YAML file into the Artifact Repository. The env variables will be defined in the triggers using substitution variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*wgFVK2vBUcwEB0annNixVw.png" /><figcaption>Cloud Build substitution variables</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQxYCIYqR6ZFPYpd_P576w.jpeg" /><figcaption><a href="https://services.google.com/fh/files/misc/practitioners_guide_to_mlops_whitepaper.pdf">CI/CD flow</a></figcaption></figure><p><strong>Step 5: Build your infrastructure.</strong></p><p>You can use Terraform to create all the infrastructure and services required for MLOps and store the scripts in your Cloud Source Repository.</p><p>In this example, we will create <strong>Google Cloud Storage buckets,</strong> <strong>Artifact Registry, Cloud Functions, Feature Store, Notebook, Metadata Store, and Cloud Scheduler jobs</strong> via Terraform scripts.</p><p>Organize your <strong>source repository</strong> using the following structure:</p><ul><li><strong>cloud-build — </strong>all Cloud Build YAML files</li><li><strong>components — </strong>the ML code (built as a Python function and stored as a component), the Dockerfiles required to create your Docker images (one for each Kubeflow Pipelines component)</li><li><strong>notebook — </strong>any<strong> </strong>notebooks used for exploratory data analysis, model analysis, and interactive experimentation on models</li><li><strong>pipelines — </strong>your<strong> </strong>Python module (for example, the model_train.py module) where the Kubeflow Pipelines workflows for data extraction, model train, model inference, and model retrain are defined</li><li><strong>src — </strong>the<strong> </strong>main.py and requirements.txt code for your Cloud Functions</li><li><strong>terraform — </strong>Terraform code for Artifact Registry, Cloud Functions, Cloud Scheduler, and Vertex AI Workbench notebooks, etc.</li><li><strong>tests — </strong>Python unit tests for the methods implemented in the component</li></ul><p><strong>Step 6: Define your IAM roles, permissions, and service accounts.</strong></p><p>A service account has to be created for running machine learning pipelines. This account will have access to all the underlying Google Cloud services used for MLOps.</p><p>Like building your infrastructure, it is leading practice to provision all the roles and permissions using Terraform.</p><p><strong>Step 7: Create a production-ready run.</strong></p><p>In a production MLOps solution, ML pipelines need to be repeatable. We will create a Cloud Function to trigger the execution of ML pipelines on Vertex AI. This can be done either using a schedule (via Cloud Scheduler) or using event processing.</p><p>In this example, we use Cloud Build to compile the pipelines using the Kubeflow Pipelines software development package and publish them to a Google Cloud Storage bucket. A Cloud Function retrieves the pipeline definition from the bucket and triggers an execution of the pipeline in Vertex AI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hnQGiEfPq_3mSGzW05UCUQ.png" /><figcaption><a href="https://services.google.com/fh/files/misc/practitioners_guide_to_mlops_whitepaper.pdf">Continuous training pipeline</a></figcaption></figure><p><strong>Step 8: Set up logging and failure notifications.</strong></p><p>Set up alerts on the Cloud Logging to establish notifications of any pipeline failures for yourself and your support team.</p><p><strong>Step 9: Establish continuous monitoring.</strong></p><p>Once the ML model has been deployed, it should be monitored to assure the model performs as expected. If suddenly a model starts returning errors or running unexpectedly slowly, you’ll want to know (and be able to fix it) immediately, ideally before your end-user notices.</p><p>Model monitoring is a continuous process; therefore, it is important to identify the critical elements to monitor for performance and reliability.</p><p>You should create a strategy for the model monitoring before deploying the model to production. Define the <em>skew </em>and<em> drift </em>thresholds for notifications and alerts, deploying the monitoring job on Vertex AI. Examine your model monitoring data from the Cloud Console.</p><p>When your model needs to be re-trained on new data, you can run the re-training pipeline. If the model needs changes to architecture, features, etc., simply deploy and re-execute the new ML pipelines using CI/CD.</p><p><strong>Step 10: Track your metadata.</strong></p><p>The<strong> </strong>metadata store,<strong> Vertex ML Metadata</strong>,<strong> </strong>keeps track of all the metadata associated with Vertex Pipeline runs and allows you to query the parameters and inputs/outputs of steps of past pipeline runs.</p><p>You can record the metadata and artifacts produced by your ML system and query that metadata to help analyze, debug, and audit the performance of your ML system or the artifacts that it produces.</p><p><strong>Summary</strong></p><p>In this article, we covered the steps to build a production- ready MLOps Framework using Vertex AI.</p><p><em>Slalom is a global consulting firm that helps people and organizations dream bigger, move faster, and build better tomorrows for all. </em><a href="https://www.slalom.com/what-we-do"><em>Learn more and reach out today.</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd3e566fa9b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>