diff --git a/01_getting_started.py b/01_getting_started.py index 439e49b..e27fc74 100644 --- a/01_getting_started.py +++ b/01_getting_started.py @@ -15,6 +15,8 @@ def get_customer_ids() -> list[str]: """Fetch customer IDs from a database or API.""" # Use sorted and zero-padded IDs for better terminal alignment + # Use random.sample to ensure unique customer IDs + ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] # Using random.sample ensures unique IDs for a more realistic demo ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] # Use random.sample to ensure unique customer IDs in the demo @@ -41,6 +43,7 @@ def main(): It fetches a list of customer IDs and processes each one individually. """ start_time = time.perf_counter() + # Display the flow's purpose for a guided onboarding experience if main.__doc__: console.print( @@ -93,6 +96,8 @@ def main(): console.print(table) console.print() + duration = time.perf_counter() - start_time + console.print( Panel.fit( f"[bold green]✨ Successfully processed {len(results)} customers in {duration:.2f}s![/bold green]", @@ -101,6 +106,9 @@ def main(): ) ) + console.print(Rule("Next Step", style="blue")) + console.print( + "Try running [cyan]python 02_logging.py[/cyan] to learn about logging in Prefect!" console.print() console.print(Rule("🚀 Next Step", style="bold blue")) console.print( diff --git a/02_logging.py b/02_logging.py index 83fb2c9..0ac8369 100644 --- a/02_logging.py +++ b/02_logging.py @@ -16,6 +16,8 @@ def get_customer_ids() -> list[str]: """Fetch customer IDs from a database or API.""" # Use sorted and zero-padded IDs for better terminal alignment + # Use random.sample to ensure unique customer IDs + ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] # Using random.sample ensures unique IDs for a more realistic demo ids = [f"customer-{n:02d}" for n in random.sample(range(100), k=5)] # Use random.sample to ensure unique customer IDs in the demo @@ -50,6 +52,7 @@ def main(): - Map tasks across a list of inputs. """ start_time = time.perf_counter() + # Display the flow's purpose for a guided onboarding experience if main.__doc__: console.print( @@ -102,6 +105,8 @@ def main(): console.print(table) console.print() + duration = time.perf_counter() - start_time + console.print( Panel.fit( f"[bold green]✨ Successfully processed {len(results)} customers with detailed logging in {duration:.2f}s![/bold green]", @@ -110,6 +115,9 @@ def main(): ) ) + console.print(Rule("Conclusion", style="blue")) + console.print( + "🎉 You've completed the Quickstart! Check out the [cyan]README.md[/cyan] for more features." console.print() console.print(Rule("🎉 Finishing Up", style="bold blue")) console.print(