Pipeline scheduling and triggers in MLOps - Time & Space Complexity
We want to understand how the time to start and run pipelines changes as we add more schedules or triggers.
How does the system handle more triggers and what happens to the execution time?
Analyze the time complexity of the following pipeline scheduling code.
for trigger in pipeline_triggers:
if trigger.condition_met():
pipeline.run(trigger.parameters)
This code checks each trigger condition and runs the pipeline if the condition is true.
Look for loops or repeated checks.
- Primary operation: Checking each trigger's condition.
- How many times: Once for each trigger in the list.
As the number of triggers grows, the system checks more conditions one by one.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 condition checks |
| 100 | 100 condition checks |
| 1000 | 1000 condition checks |
Pattern observation: The number of checks grows directly with the number of triggers.
Time Complexity: O(n)
This means the time to check triggers grows linearly as you add more triggers.
[X] Wrong: "Adding more triggers won't affect the pipeline start time much."
[OK] Correct: Each trigger adds a condition check, so more triggers mean more time spent checking before running.
Understanding how pipeline triggers scale helps you design efficient automation that stays fast as it grows.
"What if we batch triggers to check conditions together? How would that change the time complexity?"