Event-Driven ML Retraining with Cloud Storage and Pub/Sub
Short answer
C Use a Cloud Storage trigger to publish a Pub/Sub message, then deploy a Pub/Sub-triggered Cloud Function to start the Kubeflow Pipelines training job on GKE.
Question
and want to use the data to refresh your model as soon as new data is available. As part of your CI/CD workflow, you want to automatically run a Kubeflow
Pipelines training job on Google Kubernetes Engine (GKE). How should you architect this workflow?
Key Takeaways
The question tests the ability to choose an event-driven architecture over polling or scheduling for real-time model updates, specifically utilizing Cloud Storage's Pub/Sub integration.
Learn how to architect an automated ML retraining workflow using Cloud Storage events, Pub/Sub, and Cloud Functions to trigger Kubeflow Pipelines on GKE efficiently.
Common mistake: Candidates often choose Option A, assuming the data pipeline should directly control downstream processes. However, this creates tight coupling and operational overhead, whereas Option C provides a cleaner, decoupled, and more scalable solution.
Expert Analysis
The core requirement is to trigger an ML training job as soon as new data becomes available, integrating with an existing CI/CD workflow. This demands an event-driven architecture rather than a polling or scheduled one.
Option C leverages Cloud Storage's native integration with Pub/Sub. When a new file lands in the bucket, it publishes a message to a Pub/Sub topic. A Cloud Function, triggered by this subscription, then initiates the Kubeflow Pipelines job on GKE. This approach ensures immediate reaction to new data, minimizes resource waste (no constant polling), and decouples the storage layer from the compute layer, which aligns perfectly with modern MLOps practices.
Option A suggests modifying the Dataflow pipeline itself to start the training job. While technically possible via service accounts, it tightly couples the data engineering pipeline with the model training workflow, violating separation of concerns and making the system harder to maintain across teams. The comments highlight that relying on the data team to modify their pipelines for ML triggers is error-prone and cumbersome.
Options B and D rely on polling mechanisms. Option B uses App Engine to continuously check for files, which incurs unnecessary costs and latency due to the polling interval. Option D uses Cloud Scheduler to run at regular intervals, leading to delays between data availability and model retraining, as well as wasted compute cycles when no new data exists. For "as soon as" requirements, event-driven architectures are superior.
Official Reference
This link opens the official vendor documentation in a new tab.
Exam Strategy
When a question specifies 'as soon as' or 'immediately' upon a data change, prioritize event-driven solutions involving Pub/Sub and Cloud Functions over polling (App Engine/Cloud Run loops) or scheduling (Cloud Scheduler). Look for native integrations like Cloud Storage triggers publishing to Pub/Sub, which provide the lowest latency and cost efficiency for reactive workflows.
Frequently Asked Questions
Why not use Cloud Scheduler to check for new files?
Can Dataflow start the training job directly?
Community Votes
89% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 13 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 13
-
Paul_Dirac 👍 7C https://cloud.google.com/architecture/architecture-for-mlops-using-tfx-kubeflow-pipelines-and-cloud-build#triggering-and-scheduling-kubeflow-pipelines
-
hiromi 👍 2 Answered CC Pubsub is the keyword
-
Fatiy 👍 1 Answered CThe scenario involves automatically running a Kubeflow Pipelines training job on GKE as soon as new data becomes available. To achieve this, we can use Cloud Storage to store the cleaned dataset, and then configure a Cloud Storage trigger that sends a message to a Pub/Sub topic whenever a new file is added to the storage bucket. We can then create a Pub/Sub-triggered Cloud Function that starts the training job on a GKE cluster.
-
taylz876 👍 1 Answered CC - You want training to start as soon as new data is available. That's an event-driven design, where the arrival of the file is the trigger: 1. A new cleaned file lands in Cloud Storage. 2. Cloud Storage publishes a message to Pub/Sub. 3. A Cloud Function receives the message and starts the Kubeflow Pipelines training job on GKE. It reacts immediately, runs only when needed, and needs no manual steps.
-
behzadsw 👍 1 Answered AThe question says: As part of your CI/CD workflow, you want to automatically run a Kubeflow.. C is also an option but it seems more cumbersome. One thing hat could be against A is that the data engineering team is separate team so they might not access your CI/CD if any changes from their side is needed..
Show 8 more comments
-
ori5225 👍 1On a schedule, using Cloud Scheduler. Responding to an event, using Pub/Sub and Cloud Functions. For example, the event can be the availability of new data files in a Cloud Storage bucket.
-
tavva_prudhvi 👍 1Option D requires the job to be scheduled at regular intervals, even if there are no new files. This can waste resources and lead to unnecessary delays in the training process.
-
tavva_prudhvi 👍 1Option A requires the data engineering team to modify the pipeline, which can be time-consuming and error-prone.
-
Mohamed_Mossad 👍 1 Answered Cevent driven architecture is better than polling based architecure so I will vote for C
-
PhilipKoku 👍 1 Answered CC) PUB/sub trigger from Cloud Storage & Cloud Function
-
Sum_Sum 👍 1 Answered CC- because you don't want to re-engineer the pipeline
-
fragkris 👍 1 Answered CC - This is the google reccomended method.
-
M25 👍 1 Answered CWent with C
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →