Skip to content

Commit 522354a

Browse files
strickvlclaude
andcommitted
Improve caching pipeline logging clarity
- Enhanced logging in cache_pipeline.py to clearly show which run uses cache - Added ASCII separators to visually distinguish between Run 1 and Run 2 - Simplified step logging to focus on the key concept - Added explanatory note highlighting that cached steps are skipped entirely - Updated utils.py separator width for consistency These changes make it much clearer to students when caching is happening and how it affects pipeline execution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 155064d commit 522354a

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

pipelines/caching/cache_pipeline.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212
@step(enable_cache=True)
1313
def slow_step() -> Annotated[int, "answer"]:
14-
logger.info("Starting slow computation (3 seconds)...")
14+
logger.info("🔄 Actually computing result... (sleeping 3 seconds)")
1515
time.sleep(3)
16-
logger.info("Computation completed!")
1716
return 42
1817

1918

@@ -23,10 +22,17 @@ def cache_pipeline():
2322

2423

2524
if __name__ == "__main__":
26-
logger.info("First run - will take ~3 seconds")
27-
cache_pipeline() # first run ~3 s
28-
29-
logger.info("Second run - should be instant (cache hit)")
30-
cache_pipeline() # second run instant (cache hit)
25+
logger.info("\n" + "="*60)
26+
logger.info(">>> RUN 1: First execution (no cache available)")
27+
logger.info("="*60)
28+
cache_pipeline()
29+
30+
logger.info("\n" + "="*60)
31+
logger.info(">>> RUN 2: Second execution (cache should be used)")
32+
logger.info("="*60)
33+
cache_pipeline()
34+
35+
logger.info("\n💡 Notice: The step's log message only appears in Run 1!")
36+
logger.info(" In Run 2, the step was skipped entirely due to caching.")
3137

3238
log_dashboard_urls("cache_pipeline")

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def log_dashboard_urls(pipeline_name: str):
1919
)
2020
dashboard_url = f"{base_url}/runs/{run.id}"
2121

22-
logger.info("\n" + "=" * 50)
22+
logger.info("\n" + "=" * 60)
2323
logger.info("✅ Pipeline execution complete!")
2424
logger.info(f"🌐 View pipeline in dashboard: {base_url}/pipelines/{pipeline_name}")
2525
logger.info(f"🌐 View this run: {dashboard_url}")
2626
logger.info(f"🌐 View all artifacts: {base_url}/artifacts")
27-
logger.info("=" * 50)
27+
logger.info("=" * 60)

0 commit comments

Comments
 (0)